Ver código fonte

Removed the Promise module.

Piotrek Koszuliński 10 anos atrás
pai
commit
e3ef28d0ed

+ 1 - 4
packages/ckeditor5-engine/.jshintrc

@@ -13,8 +13,5 @@
 
 	"globals": {
 		"CKEDITOR": false
-	},
-	"predef": [
-		"-Promise"
-	]
+	}
 }

+ 1 - 1
packages/ckeditor5-engine/src/ckeditor.js

@@ -14,7 +14,7 @@
  * @singleton
  */
 
-CKEDITOR.define( [ 'editor', 'collection', 'promise', 'config' ], function( Editor, Collection, Promise, Config ) {
+CKEDITOR.define( [ 'editor', 'collection', 'config' ], function( Editor, Collection, Config ) {
 	var CKEDITOR = {
 		/**
 		 * A collection containing all editor instances created.

+ 1 - 2
packages/ckeditor5-engine/src/editor.js

@@ -16,10 +16,9 @@ CKEDITOR.define( [
 	'model',
 	'editorconfig',
 	'plugincollection',
-	'promise',
 	'creator',
 	'ckeditorerror'
-], function( Model, EditorConfig, PluginCollection, Promise, Creator, CKEditorError ) {
+], function( Model, EditorConfig, PluginCollection, Creator, CKEditorError ) {
 	class Editor extends Model {
 		/**
 		 * Creates a new instance of the Editor class.

+ 1 - 2
packages/ckeditor5-engine/src/plugincollection.js

@@ -14,11 +14,10 @@
 
 CKEDITOR.define( [
 	'collection',
-	'promise',
 	'plugin',
 	'ckeditorerror',
 	'log'
-], function( Collection, Promise, Plugin, CKEditorError, log ) {
+], function( Collection, Plugin, CKEditorError, log ) {
 	class PluginCollection extends Collection {
 		/**
 		 * Creates an instance of the PluginCollection class, initializing it with a set of plugins.

+ 0 - 28
packages/ckeditor5-engine/src/promise.js

@@ -1,28 +0,0 @@
-/**
- * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-/* globals window */
-
-'use strict';
-
-/**
- * An ES6 compatible Promise class, used for deferred and asynchronous computations.
- *
- * @class Promise
- */
-
-CKEDITOR.define( function() {
-	// For now we're using the native browser implementation of Promise, an ES6 feature. Just IE is not supporting it so
-	// a polyfill will have to be developed for it.
-	//
-	// http://caniuse.com/#feat=promises
-
-	/* istanbul ignore next: we expect this to never happen for now, so we'll not have coverage for this */
-	if ( !window.Promise ) {
-		throw new Error( 'The Promise class is not available natively. CKEditor is not compatible with this browser.' );
-	}
-
-	return window.Promise;
-} );

+ 1 - 4
packages/ckeditor5-engine/tests/.jshintrc

@@ -25,8 +25,5 @@
 		"bender": false,
 		"sinon": false,
 		"setTimeout": false
-	},
-	"predef": [
-		"-Promise"
-	]
+	}
 }

+ 1 - 2
packages/ckeditor5-engine/tests/ckeditor/ckeditor.js

@@ -8,7 +8,7 @@
 
 'use strict';
 
-var modules = bender.amd.require( 'ckeditor', 'editor', 'promise', 'config' );
+var modules = bender.amd.require( 'ckeditor', 'editor', 'config' );
 
 var content = document.getElementById( 'content' );
 var editorConfig = { plugins: 'creator-test' };
@@ -28,7 +28,6 @@ beforeEach( function() {
 describe( 'create', function() {
 	it( 'should return a promise', function() {
 		var CKEDITOR = modules.ckeditor;
-		var Promise = modules.promise;
 
 		expect( CKEDITOR.create( content, editorConfig ) ).to.be.instanceof( Promise );
 	} );

+ 3 - 3
packages/ckeditor5-engine/tests/editor/creator.js

@@ -8,7 +8,7 @@
 /* globals document */
 /* bender-include: ../_tools/tools.js */
 
-var modules = bender.amd.require( 'editor', 'plugin', 'promise', 'creator', 'ckeditorerror' );
+var modules = bender.amd.require( 'editor', 'plugin', 'creator', 'ckeditorerror' );
 var editor, element;
 
 function initEditor( config ) {
@@ -37,7 +37,7 @@ before( function() {
 		return class extends Plugin {};
 	} );
 
-	CKEDITOR.define( 'plugin!creator-async-create', [ 'creator', 'promise' ], function( Creator, Promise ) {
+	CKEDITOR.define( 'plugin!creator-async-create', [ 'creator' ], function( Creator ) {
 		return class extends Creator {
 			create() {
 				return new Promise( ( resolve, reject ) => {
@@ -49,7 +49,7 @@ before( function() {
 		};
 	} );
 
-	CKEDITOR.define( 'plugin!creator-async-destroy', [ 'creator', 'promise' ], function( Creator, Promise ) {
+	CKEDITOR.define( 'plugin!creator-async-destroy', [ 'creator' ], function( Creator ) {
 		return class extends Creator {
 			create() {}
 

+ 2 - 3
packages/ckeditor5-engine/tests/editor/editor.js

@@ -8,7 +8,7 @@
 
 'use strict';
 
-var modules = bender.amd.require( 'editor', 'editorconfig', 'plugin', 'promise' );
+var modules = bender.amd.require( 'editor', 'editorconfig', 'plugin' );
 
 var editor;
 var element;
@@ -44,7 +44,7 @@ before( function() {
 
 	asyncSpy = sinon.spy().named( 'async-call-spy' );
 
-	CKEDITOR.define( 'plugin!async', [ 'plugin', 'promise' ], function( Plugin, Promise ) {
+	CKEDITOR.define( 'plugin!async', [ 'plugin' ], function( Plugin ) {
 		class PluginAsync extends Plugin {}
 
 		PluginAsync.prototype.init = sinon.spy( function() {
@@ -87,7 +87,6 @@ describe( 'config', function() {
 
 describe( 'init', function() {
 	it( 'should return a promise that resolves properly', function() {
-		var Promise = modules.promise;
 		var Editor = modules.editor;
 
 		editor = new Editor( element, {

+ 0 - 22
packages/ckeditor5-engine/tests/promise/promise.js

@@ -1,22 +0,0 @@
-/**
- * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-'use strict';
-
-var modules = bender.amd.require( 'promise' );
-
-describe( 'Promise', function() {
-	it( 'should resolve properly', function() {
-		var Promise = modules.promise;
-
-		var promise = new Promise( function( resolve ) {
-			resolve( 1 );
-		} );
-
-		return promise.then( function( value ) {
-			expect( value ).to.equal( 1 );
-		} );
-	} );
-} );