promise.js 789 B

12345678910111213141516171819202122232425262728
  1. /**
  2. * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* globals window */
  6. 'use strict';
  7. /**
  8. * An ES6 compatible Promise class, used for deferred and asynchronous computations.
  9. *
  10. * @class Promise
  11. */
  12. CKEDITOR.define( function() {
  13. // For now we're using the native browser implementation of Promise, an ES6 feature. Just IE is not supporting it so
  14. // a polyfill will have to be developed for it.
  15. //
  16. // http://caniuse.com/#feat=promises
  17. /* istanbul ignore next: we expect this to never happen for now, so we'll not have coverage for this */
  18. if ( !window.Promise ) {
  19. throw 'The Promise class is not available natively. CKEditor is not compatible with this browser.';
  20. }
  21. return window.Promise;
  22. } );