Globlization and Object.system.load

Brendan Eich brendan at mozilla.com
Thu Nov 17 15:23:22 PST 2011


I didn't make up load from whole cloth, there's a proposal at

http://wiki.ecmascript.org/doku.php?id=harmony:module_loaders

Module people should weigh in.

/be


On Nov 17, 2011, at 3:08 PM, Roozbeh Pournader wrote:

> I was talking with Nebojša about the Object.system.load interface for
> loading globalization, thinking from the user side.
> 
> Brendan's email suggested something like this:
> 
> Object.system.load = function(name, callback) {
>  if (name === '@g11n') {
>    callback(v8Locale);
>  }
> };
> 
> That would make something like this the minimum code needed to use the module:
> 
> var g11n;
> Object.system.load("@g11n", function (g11n_module) {
>   g11n = g11n_module;
> });
> 
> What if we define load to be something like the following?
> 
> Object.system.load = function(name, callback) {
>  if (name === '@g11n') {
>    if (callback) {
>      callback(v8Locale);
>    } else {
>      return v8Locale;
>    }
>  }
> };
> 
> That way, a user who can afford the delay, or know that this is
> immediate in Chrome, can simply do:
> 
> var g11n = Object.system.load("@g11n");
> 
> While the users who want the callback, can call it using the proper method.
> 
> Roozbeh
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list