mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-18 07:31:04 +00:00
42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
/*!
|
|
{
|
|
"name": "ES6 Promises",
|
|
"property": "promises",
|
|
"caniuse": "promises",
|
|
"polyfills": ["es6promises"],
|
|
"authors": ["Krister Kari", "Jake Archibald"],
|
|
"tags": ["es6"],
|
|
"notes": [{
|
|
"name": "The ES6 promises spec",
|
|
"href": "https://github.com/domenic/promises-unwrapping"
|
|
}, {
|
|
"name": "Chromium dashboard - ES6 Promises",
|
|
"href": "https://www.chromestatus.com/features/5681726336532480"
|
|
}, {
|
|
"name": "JavaScript Promises: an Introduction",
|
|
"href": "https://developers.google.com/web/fundamentals/primers/promises/"
|
|
}]
|
|
}
|
|
!*/
|
|
/* DOC
|
|
Check if browser implements ECMAScript 6 Promises per specification.
|
|
*/
|
|
define(['Modernizr'], function(Modernizr) {
|
|
Modernizr.addTest('promises', function() {
|
|
return 'Promise' in window &&
|
|
// Some of these methods are missing from
|
|
// Firefox/Chrome experimental implementations
|
|
'resolve' in window.Promise &&
|
|
'reject' in window.Promise &&
|
|
'all' in window.Promise &&
|
|
'race' in window.Promise &&
|
|
// Older version of the spec had a resolver object
|
|
// as the arg rather than a function
|
|
(function() {
|
|
var resolve;
|
|
new window.Promise(function(r) { resolve = r; });
|
|
return typeof resolve === 'function';
|
|
}());
|
|
});
|
|
});
|