ericmckean / traceur-compiler

Automatically exported from code.google.com/p/traceur-compiler
Apache License 2.0
0 stars 0 forks source link

Encode options in repl.html demo URL #192

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am going to give a talk next month that includes some discussion of Traceur. 
I want to send users to this snippet:

http://traceur-compiler.googlecode.com/git/demo/repl.html#%2F**%20%40return%20%7
BDeferred.%3Cstring%3E%7D%20*%2F%20%0Avar%20simpleGet%20%3D%20function(url)%20%7
B%20%0A%20%20var%20deferred%20%3D%20new%20Deferred()%3B%20%0A%0A%20%20var%20xhr%
20%3D%20new%20XMLHttpRequest()%3B%20%0A%20%20xhr.onreadystatechange%20%3D%20func
tion()%20%7B%20%0A%20%20%20%20if%20(xhr.readyState%20%3D%3D%204)%20%7B%20%0A%20%
20%20%20%20%20if%20(xhr.status%20%3D%3D%20200)%20%7B%20%0A%20%20%20%20%20%20%20%
20deferred.callback(xhr.responseText)%3B%20%0A%20%20%20%20%20%20%7D%20else%20%7B
%20%0A%20%20%20%20%20%20%20%20deferred.errback(xhr.status)%3B%20%0A%20%20%20%20%
20%20%7D%20%0A%20%20%20%20%7D%20%0A%20%20%7D%3B%20%0A%20%20xhr.open('GET'%2C%20u
rl%2C%20true%20%2F*%20async%20*%2F)%3B%20%0A%20%20xhr.send(null)%3B%20%0A%0A%20%
20return%20deferred%3B%20%0A%7D%3B%0A%0Avar%20run%20%3D%20function()%20%7B%0A%20
%20var%20html%3B%0A%20%20await%20html%20%3D%20simpleGet('repl.html')%3B%0A%20%20
console.log(html)%3B%0A%7D%3B%0A%0Arun()%3B%0A

which, fear not, I have shortened to:

http://bit.ly/XwaPom

However, this does not work because the user must select Options->experimental 
from the upper-right-hand-corner. Would it be possible to support a URL that 
encodes the options that need to be enabled so I could send out such a link 
that "just works"?

Alternatively, I can include my instructions in a comment at the start of the 
code snippet.

Thanks,
Michael

Original issue reported on code.google.com by bolinf...@gmail.com on 22 Jan 2013 at 2:14

GoogleCodeExporter commented 9 years ago
The initial patch for storing stuff in the URL encoded the options too.

We could either put it in the URL or in a comment of the code like we do in the 
test.

// Options: --deferred-functions

Original comment by arv@chromium.org on 22 Jan 2013 at 3:56

GoogleCodeExporter commented 9 years ago
https://code.google.com/p/traceur-compiler/source/detail?r=c1e693c

I ended up using "// Options:" comments since we already use that in other 
places in Traceur.

Original comment by arv@chromium.org on 24 Jan 2013 at 5:06