Modules loader define method

Jeff Morrison lbljeffmo at gmail.com
Thu Oct 31 20:32:56 PDT 2013


This is excellent, but I had been worried about a string/eval-based 
define() API as well.

Throwing this out there while I stew on the pros/cons of it (so others 
can as well):
I wonder how terrible it would be to have this API define module bodies 
in terms of a passed function that, say, accepted and/or returned a 
module object?

-Jeff

On 10/31/13, 7:10 AM, Erik Arvidsson wrote:
> I see that Jason added a Loader.prototype.define to his reference 
> implementation. 
> https://people.mozilla.org/~jorendorff/js-loaders/Loader.html#section-177 
> <https://people.mozilla.org/%7Ejorendorff/js-loaders/Loader.html#section-177>. 
> This is great. It is a much needed capability to allow bundling 
> modules into a single file.
>
> It allows you to do something like
>
> System.define(['url-a', urlB], ['export var a = "a";', 
> moduleBodyForUrlB]);
>
> However, this is just another form of eval and will therefore not be 
> available in CSP. Can we come up with something that works in CSP 
> environments? How about?
>
> module 'url-a' {
>   export var a = "a";
> }
>
> =P
>
> -- 
> erik
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131031/aa8c0a21/attachment.html>


More information about the es-discuss mailing list