Browse Source

Made it more ESsixy.

Piotrek Koszuliński 10 years ago
parent
commit
3f4063de0f
1 changed files with 4 additions and 12 deletions
  1. 4 12
      packages/ckeditor5-engine/src/editor.js

+ 4 - 12
packages/ckeditor5-engine/src/editor.js

@@ -105,24 +105,16 @@ CKEDITOR.define( [
 				var promise = Promise.resolve();
 				var promise = Promise.resolve();
 
 
 				// Chain it with promises that resolve with the init() call of every plugin.
 				// Chain it with promises that resolve with the init() call of every plugin.
-				for ( var i = 0; i < loadedPlugins.length; i++ ) {
-					promise = promise.then( callInit( loadedPlugins[ i ] ) );
+				for ( let i = 0; i < loadedPlugins.length; i++ ) {
+					promise = promise.then( () => loadedPlugins[ i ].init() );
 				}
 				}
 
 
 				// Return the promise chain.
 				// Return the promise chain.
 				return promise;
 				return promise;
-
-				function callInit( plugin ) {
-					return function() {
-						// Returns init(). If it is a promise, the next then() interation will be called only when it
-						// will be resolved, enabling asynchronous init().
-						return plugin.init();
-					};
-				}
 			}
 			}
 
 
 			function findCreators() {
 			function findCreators() {
-				that.plugins.forEach( function( plugin, name ) {
+				that.plugins.forEach( ( plugin, name ) => {
 					if ( plugin instanceof Creator ) {
 					if ( plugin instanceof Creator ) {
 						that._creators[ name ] = plugin;
 						that._creators[ name ] = plugin;
 					}
 					}
@@ -178,7 +170,7 @@ CKEDITOR.define( [
 
 
 			delete this.element;
 			delete this.element;
 
 
-			return Promise.resolve().then( function() {
+			return Promise.resolve().then( () => {
 				return that._creator && that._creator.destroy();
 				return that._creator && that._creator.destroy();
 			} );
 			} );
 		}
 		}