Parcourir la source

Code refactoring: Simplified ViewCollection#destroy.

Aleksander Nowodzinski il y a 8 ans
Parent
commit
ea095b229e
1 fichiers modifiés avec 1 ajouts et 7 suppressions
  1. 1 7
      packages/ckeditor5-ui/src/viewcollection.js

+ 1 - 7
packages/ckeditor5-ui/src/viewcollection.js

@@ -114,13 +114,7 @@ export default class ViewCollection extends Collection {
 		return Promise.all( this._addPromises )
 			// Then begin the process of destroying the children.
 			.then( () => {
-				let destroyPromises = [];
-
-				for ( let view of this ) {
-					destroyPromises.push( view.destroy() );
-				}
-
-				return Promise.all( destroyPromises );
+				return Promise.all( Array.from( this, view => view.destroy() ) );
 			} );
 	}