| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- /*!
- {
- "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';
- }());
- });
- });
|