Open gfx opened 11 years ago
native("require('fs')") class fs { ... }
The syntax seems intuitive to me and I am on to the idea.
OTOH I do not see any merit in introducing
native("require('es5-shim')");
Can't es5-shim.js be loaded separately (at JavaScript level)?
Ah, es5-shim.js should be loaded by <script>; however, native("...");
will be useful to inject so-called polyfills in the local scope.
For example taken from https://gist.github.com/7shi/5487552 :
native("var HTMLDocument = typeof(HTMLDocument) == 'undefined' : window.Document : window.HTMLDocument"); // for IE10
However, this is a completely separated idea from loading CommonJS-like modules and needs carefully considering.
@gfx I agree that it would be great if we could fix the issue pointed out by the gist (though I am not sure how we should do), and that it should be handled as a separate issue. Please open a separate issue regarding the problem.
Reopening to reconsider the native("...")
notation. Please see the discussion at https://github.com/jsx/JSX/issues/154#issuecomment-17484849
JSX lacks a way to apply "new" operator to classes loaded by CommonJS-like require(). Thus, we have to use
js.eval() in some cases; it may unexpectedly bind local variables like
$__jsx_extend` and also could affect performance.The syntax may be something like this (not perfect, though):
This issue is a part of #4.