Closed tariqbenezza closed 7 years ago
It would be nice to have a checkbox / flag for that (like [ ] script mode
or something),
because your detection could be quite random:
trace("class"); // ouch
elem.className += "some-stuff"; // ouch
Also, please rebase.
Also, you should move your isScript
check right after checkMacros(source)
Well done :) I'll probably release it this week end :D
I didn't know that you have to instantiate a class to Try Haxe ;)
Why didn't you, I mean every example has a class. I do like the feature, but I wonder if it isn't weird to hide this while "normal" Haxe requires a class?
@markknol I wasn't too sure about this feature either (see previous comment about checkbox), but I must say it makes a lot of sense, especially for smaller snippets (code.haxe.org or haxe manual ?).
Next steps I thought of (to be discussed ;)):
maybe add a header like the following, for even easier copy/paste from JS (poke @matthijskamstra :+1:)
#if js
import js.Browser.*
#end
allow import
s in scripts (skip import
lines in detection, reinject them before main class
)
add a notification / warning that it's indeed not a complete Haxe module, with button or link to expand to the real underlying Haxe module.
So, FYI, I've done the first *, and all is online :D
During my first steps in Try Haxe I waste a lot of time to undertand why something like
for (i in [1, 2, 3]) { trace(i); }
was not working.
Indeed, I didn't know that you have to instantiate a class to Try Haxe ;)
Now it's implicit