Dynamically changing of loader global

David Bruant bruant.d at gmail.com
Mon Dec 24 14:55:45 PST 2012


For that matter, you've implemented the "initial" solution in continuum 
[1] because you look at options.global when constructing the loader, but 
never look at it ever after.

By the way, maybe you should Object-wrap it or throw if it isn't an 
object? The proposal doesn't say which should occur.

David

[1] 
https://github.com/Benvie/continuum/blob/6338e3cdfc5a472d0998a6343ed38d5dc31e454c/engine/builtins/%40system.js#L50

Le 24/12/2012 23:37, Brandon Benvie a écrit :
> To clarify: are you asking if an arbitrary object is a valid global 
> object when using a custom loader? If not, then I have a lot of code 
> to rewrite.
>
>
> On Mon, Dec 24, 2012 at 5:34 PM, David Bruant <bruant.d at gmail.com 
> <mailto:bruant.d at gmail.com>> wrote:
>
>     Hi,
>
>     I've reading the loader API [1] and I was wondering if it was
>     possible to dynamically change the global. I think it is by doing
>     the following, but tell me if I'm wrong:
>
>         const options = {
>             global : {
>                 changeGlobal: function(g){
>                     options.global = g;
>                 }
>             }
>         }
>
>         var l = new Loader(Loader, options);
>
>         l.eval('changeGlobal({a:37}); console.log(a);');
>
>     In other words, in the global in the loader the initial or the
>     dynamic value of the "global" option?
>     If it was the dynamic value, I think it would help a lot in the
>     document.open situation [2]
>
>     David
>
>     [1]
>     http://wiki.ecmascript.org/doku.php?id=harmony:module_loaders#loader_api
>     [2] http://lists.w3.org/Archives/Public/www-dom/2012OctDec/0166.html
>     _______________________________________________
>     es-discuss mailing list
>     es-discuss at mozilla.org <mailto: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/20121224/7f4d6125/attachment.html>


More information about the es-discuss mailing list