-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #245 from l-atelier-des-chercheurs/develop
Develop
- Loading branch information
Showing
35 changed files
with
757 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "promise-polyfill", | ||
"version": "6.0.2", | ||
"homepage": "https://github.com/taylorhakes/promise-polyfill", | ||
"authors": [ | ||
"Taylor Hakes" | ||
], | ||
"description": "Lightweight promise polyfill for the browser and node. A+ Compliant.", | ||
"main": "promise.js", | ||
"moduleType": [ | ||
"globals", | ||
"node" | ||
], | ||
"keywords": [ | ||
"promise", | ||
"es6", | ||
"polyfill", | ||
"html5" | ||
], | ||
"license": "MIT", | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"test", | ||
"tests" | ||
], | ||
"_release": "6.0.2", | ||
"_resolution": { | ||
"type": "version", | ||
"tag": "6.0.2", | ||
"commit": "3591c457e9999ecf5e5c648ed68d4f21a0ad3d11" | ||
}, | ||
"_source": "https://github.com/taylorhakes/promise-polyfill.git", | ||
"_target": "^6.0.2", | ||
"_originalSource": "promise-polyfill", | ||
"_direct": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Changelog | ||
|
||
## 6.0.0 Deprecated `Promise._setImmediateFn` and `Promise._setUnhandledRejectionFn` | ||
This allows subclassing Promise without rewriting functions | ||
- `Promise._setImmediateFn(<immediateFn>)` has been deprecated. Use `Promise._immediateFn = <immediateFn>` instead. | ||
- `Promise._setUnhandledRejectionFn(<rejectionFn>)` has been deprecated. Use `Promise._unhandledRejectionFn = <rejectionFn>` instead. | ||
These functions will be removed in the next major version. | ||
|
||
### 5.2.1 setTimeout to 0 | ||
Fixed bug where setTimeout was set to 1 instead of 0 for async execution | ||
|
||
### 5.2.0 Subclassing | ||
Allowed Subclassing. [#27](https://github.com/taylorhakes/promise-polyfill/pull/27) | ||
|
||
### 5.1.0 Fixed reliance on setTimeout | ||
Changed possibly unhanded warnings to use asap function instead of setTimeout | ||
|
||
## 5.0.0 Removed multiple params from Promise.all | ||
Removed non standard functionality of passing multiple params to Promise.all. You must pass an array now. You must change this code | ||
```js | ||
Promise.all(prom1, prom2, prom3); | ||
``` | ||
to this | ||
```js | ||
Promise.all([prom1, prom2, prom3]); | ||
``` | ||
|
||
### 4.0.4 IE8 console.warn fix | ||
IE8 does not have console, unless you open the developer tools. This fix checks to makes sure console.warn is defined before calling it. | ||
|
||
### 4.0.3 Fix case in bower.json | ||
bower.json had Promise.js instead of promise.js | ||
|
||
### 4.0.2 promise.js case fix in package.json | ||
Fixed promise.js in package.json. It was accidently published as Promise.js | ||
|
||
## 4.0.1 Unhandled Rejections and Other Fixes | ||
- Added unhandled rejection warnings to the console | ||
- Removed Grunt, jasmine and other unused code | ||
- Renamed Promise.js to lowercase promise.js in multiple places | ||
|
||
### 3.0.1 Fixed shadowing issue on setTimeout | ||
New version fixing this major bug https://github.com/taylorhakes/promise-polyfill/pull/17 | ||
|
||
## 3.0.0 Updated setTimeout to not be affected by test mocks | ||
This is considered a breaking change because people may have been using this functionality. If you would like to keep version 2 functionality, set Promise._setImmediateFn on `promise-polyfill` like the code below. | ||
|
||
```js | ||
var Promise = require('promise-polyfill'); | ||
Promise._setImmedateFn(function(fn) { | ||
setTimeout(fn, 1); | ||
}); | ||
``` | ||
|
||
### 2.1.0 Promise._setImmedateFn | ||
Removed dead code Promise.immedateFn and added Promise._setImmediateFn(fn); | ||
|
||
### 2.0.2 Simplified Global detection | ||
Simplified attaching to global object | ||
|
||
### 2.0.1 Webworker bugfixes | ||
Fixed Webworkers missing window object | ||
|
||
## 2.0.0 | ||
**Changed the following line** | ||
``` | ||
module.exports = root.Promise ? root.Promise : Promise; | ||
``` | ||
to | ||
``` | ||
module.exports = Promise; | ||
``` | ||
|
||
This means the library will not use built-in Promise by default. This allows for more consistency. | ||
|
||
You can easily add the functionality back. | ||
``` | ||
var Promise = window.Promise || require('promise-polyfill'); | ||
``` | ||
|
||
**Added Promise.immediateFn to allow changing the setImmedate function** | ||
``` | ||
Promise.immediateFn = window.setAsap; | ||
``` | ||
|
||
### 1.1.4 Updated Promise to use correct global object in Browser and Node | ||
|
||
### 1.1.3 Fixed browserify issue with `this` | ||
|
||
### 1.1.2 Updated Promise.resolve to resolve with original Promise | ||
|
||
### 1.1.0 Performance Improvements for Modern Browsers | ||
|
||
## 1.0.1 Update README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2014 Taylor Hakes | ||
Copyright (c) 2014 Forbes Lindesay | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<a href="http://promises-aplus.github.com/promises-spec"> | ||
<img src="http://promises-aplus.github.com/promises-spec/assets/logo-small.png" | ||
align="right" alt="Promises/A+ logo" /> | ||
</a> | ||
# Promise Polyfill | ||
[![travis][travis-image]][travis-url] | ||
|
||
[travis-image]: https://img.shields.io/travis/taylorhakes/promise-polyfill.svg?style=flat | ||
[travis-url]: https://travis-ci.org/taylorhakes/promise-polyfill | ||
|
||
|
||
Lightweight ES6 Promise polyfill for the browser and node. Adheres closely to the spec. It is a perfect polyfill IE, Firefox or any other browser that does not support native promises. | ||
|
||
For API information about Promises, please check out this article [HTML5Rocks article](http://www.html5rocks.com/en/tutorials/es6/promises/). | ||
|
||
It is extremely lightweight. ***< 1kb Gzipped*** | ||
|
||
## Browser Support | ||
IE8+, Chrome, Firefox, IOS 4+, Safari 5+, Opera | ||
|
||
### NPM Use | ||
``` | ||
npm install promise-polyfill --save-exact | ||
``` | ||
### Bower Use | ||
``` | ||
bower install promise-polyfill | ||
``` | ||
|
||
## Downloads | ||
|
||
- [Promise](https://raw.github.com/taylorhakes/promise-polyfill/master/promise.js) | ||
- [Promise-min](https://raw.github.com/taylorhakes/promise-polyfill/master/promise.min.js) | ||
|
||
## Simple use | ||
```js | ||
var prom = new Promise(function(resolve, reject) { | ||
// do a thing, possibly async, then… | ||
|
||
if (/* everything turned out fine */) { | ||
resolve("Stuff worked!"); | ||
} else { | ||
reject(new Error("It broke")); | ||
} | ||
}); | ||
|
||
prom.then(function(result) { | ||
// Do something when async done | ||
}); | ||
``` | ||
|
||
## Deprecations | ||
- `Promise._setImmediateFn(<immediateFn>)` has been deprecated. Use `Promise._immediateFn = <immediateFn>;` instead. | ||
- `Promise._setUnhandledRejectionFn(<rejectionFn>)` has been deprecated. Use `Promise._unhandledRejectionFn = <rejectionFn>` instead. | ||
These functions will be removed in the next major version. | ||
|
||
## Performance | ||
By default promise-polyfill uses `setImmediate`, but falls back to `setTimeout` for executing asynchronously. If a browser does not support `setImmediate` (IE/Edge are the only browsers with setImmediate), you may see performance issues. | ||
Use a `setImmediate` polyfill to fix this issue. [setAsap](https://github.com/taylorhakes/setAsap) or [setImmediate](https://github.com/YuzuJS/setImmediate) work well. | ||
|
||
If you polyfill `window.setImmediate` or use `Promise._immediateFn = yourImmediateFn` it will be used instead of `window.setTimeout` | ||
``` | ||
npm install setasap --save | ||
``` | ||
```js | ||
var Promise = require('promise-polyfill'); | ||
var setAsap = require('setasap'); | ||
Promise._immediateFn = setAsap; | ||
``` | ||
|
||
## Unhandled Rejections | ||
promise-polyfill will warn you about possibly unhandled rejections. It will show a console warning if a Promise is rejected, but no `.catch` is used. You can turn off this behavior by setting `Promise._setUnhandledRejectionFn(<rejectError>)`. | ||
If you would like to disable unhandled rejections. Use a noop like below. | ||
```js | ||
Promise._unhandledRejectionFn = function(rejectError) {}; | ||
``` | ||
|
||
|
||
## Testing | ||
``` | ||
npm install | ||
npm test | ||
``` | ||
|
||
## License | ||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "promise-polyfill", | ||
"version": "2.1.0", | ||
"homepage": "https://github.com/taylorhakes/promise-polyfill", | ||
"authors": [ | ||
"Taylor Hakes" | ||
], | ||
"description": "Lightweight promise polyfill for the browser and node. A+ Compliant.", | ||
"main": "promise.js", | ||
"moduleType": [ | ||
"globals", | ||
"node" | ||
], | ||
"keywords": [ | ||
"promise", | ||
"es6", | ||
"polyfill", | ||
"html5" | ||
], | ||
"license": "MIT", | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"test", | ||
"tests" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Karma configuration | ||
// Generated on Tue Jan 12 2016 07:56:12 GMT-0500 (EST) | ||
|
||
module.exports = function (config) { | ||
config.set({ | ||
|
||
// base path that will be used to resolve all patterns (eg. files, exclude) | ||
basePath: '', | ||
|
||
|
||
// frameworks to use | ||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter | ||
frameworks: ['mocha', 'browserify'], | ||
|
||
|
||
// list of files / patterns to load in the browser | ||
files: [ | ||
'test/promise.js' | ||
], | ||
|
||
|
||
// list of files to exclude | ||
exclude: [], | ||
|
||
|
||
// preprocess matching files before serving them to the browser | ||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor | ||
preprocessors: { | ||
'test/promise.js': ['browserify'] | ||
}, | ||
|
||
|
||
// test results reporter to use | ||
// possible values: 'dots', 'progress' | ||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter | ||
reporters: ['progress'], | ||
|
||
|
||
// web server port | ||
port: 9876, | ||
|
||
|
||
// enable / disable colors in the output (reporters and logs) | ||
colors: true, | ||
|
||
|
||
// level of logging | ||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
logLevel: config.LOG_INFO, | ||
|
||
|
||
// enable / disable watching file and executing tests whenever any file changes | ||
autoWatch: true, | ||
|
||
|
||
// start these browsers | ||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher | ||
browsers: ['Chrome'], | ||
|
||
|
||
// Continuous Integration mode | ||
// if true, Karma captures browsers, runs the tests and exits | ||
singleRun: false, | ||
|
||
// Concurrency level | ||
// how many browser should be started simultaneous | ||
concurrency: Infinity, | ||
|
||
plugins: [ | ||
'karma-browserify', | ||
'karma-mocha', | ||
'karma-chrome-launcher' | ||
] | ||
}) | ||
} |
Oops, something went wrong.