Can someone point me to the spec for `System.import`?

https://github.com/jorendorff/js-loaders/blob/master/browser-loader.js
doesn't seem to include it.

It seems to me that it would be worthwhile to ensure that
`System.import` had good semantics.  It would allow a nice migration
path for existing AMD and node-style modules.  For example:

```js
// AMD-style define!
// (Promise.map and Promise.spread would be nice here; see
//  https://github.com/cscott/prfun)
function define(deps, f) {
  return Promise.all(deps.map(d => System.import(d)))
    .then( (...args) => f(...args) )
    .then( registerModule )
}
```

and

```js
// Node-style require needs more magic.
Promise.async(function*() {
  /* start module text */
  var fs = yield System.import('fs');
  // etc.
  /* end module text */
  return module.exports;
}).then( registerModule );
```

But that implies that `System.import` has well defined cycle-breaking,
extensibility, etc.  Could it?
 --scott

ps. https://gist.github.com/wycats/51c96e3adcdb3a68cbc3/#comment-1006744

--
                         ( http://cscott.net/ )
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to