|
2 | 2 |
|
3 | 3 | Dynamically loads ES6 modules in NodeJS and current browsers. |
4 | 4 |
|
5 | | -The complete combined polyfill comes to 15KB minified, making it suitable for production use, provided that modules are built into ES5 making them independent of Traceur. Build workflows are currently in progress. |
6 | | - |
7 | 5 | * Provides an asynchronous loader (`System.import`) to [dynamically load ES6 modules](#getting-started) in all modern browsers including IE9+. |
8 | 6 | * Uses [Traceur](https://github.com/google/traceur-compiler) for compiling ES6 modules and syntax into ES5 in the browser with source map support |
9 | 7 | * Adds support for the `<script type="module">` tag allowing inline module loading. |
10 | 8 | * Loader hooks can be used to [extend the System loader with custom functionality](#creating-a-custom-loader) |
11 | 9 | * [Compatible with NodeJS](#nodejs-support) allowing for server-side module loading |
| 10 | +* Polyfills ES6 Promises in the browser with a bundled [when.js](https://github.com/cujojs/when/blob/master/docs/es6-promise-shim.md) implementation. |
| 11 | + |
| 12 | +The complete combined polyfill comes to 22KB minified, making it suitable for production use, provided that modules are built into ES5 making them independent of Traceur. Build workflows are currently in progress. |
12 | 13 |
|
13 | 14 | See the [demo folder](https://github.com/ModuleLoader/es6-module-loader/blob/master/demo/index.html) in this repo for a working example demonstrating both module loading the module tag in the browser. |
14 | 15 |
|
@@ -351,10 +352,9 @@ function locate(load) { |
351 | 352 |
|
352 | 353 | function fetch(load) { |
353 | 354 | // return a promise. Alternatively, just use the system fetch |
354 | | - // promise -return System.fetch(load) |
355 | | - var defer = MyPromiseLibrary.createDeferred(); |
356 | | - myXhr.get(load.address, defer.resolve, defer.reject); |
357 | | - return defer.promise; |
| 355 | + return new Promise(function(resolve, reject) { |
| 356 | + myXhr.get(load.address, resolve, reject); |
| 357 | + }); |
358 | 358 | } |
359 | 359 |
|
360 | 360 | function translate(load) { |
@@ -414,7 +414,7 @@ _Also, please don't edit files in the "dist" subdirectory as they are generated |
414 | 414 | ## Credit |
415 | 415 | Copyright (c) 2014 Luke Hoban, Addy Osmani, Guy Bedford |
416 | 416 |
|
417 | | -Promises Integration from [Promiscuous](https://github.com/RubenVerborgh/promiscuous/), Copyright (c) 2013-2014 Ruben Verborgh, MIT License |
| 417 | +ES6 Promises integration from [when.js](https://github.com/cujojs/when/blob/master/docs/es6-promise-shim.md), Copyright (c) 2010-2014 Brian Cavalier, John Hann, MIT License |
418 | 418 |
|
419 | 419 | ## License |
420 | 420 | Licensed under the MIT license. |
0 commit comments