Browse Source

Code refactoring in ViewCollection class.

Aleksander Nowodzinski 9 years ago
parent
commit
de2dde600b
1 changed files with 2 additions and 2 deletions
  1. 2 2
      packages/ckeditor5-ui/src/viewcollection.js

+ 2 - 2
packages/ckeditor5-ui/src/viewcollection.js

@@ -149,12 +149,12 @@ export default class ViewCollection extends Collection {
 				}
 				}
 
 
 				// Synchronize views as new items are added to the collection.
 				// Synchronize views as new items are added to the collection.
-				collection.on( 'add', ( evt, item, index ) => {
+				this.listenTo( collection, 'add', ( evt, item, index ) => {
 					this.add( createView( item ), index );
 					this.add( createView( item ), index );
 				} );
 				} );
 
 
 				// Synchronize views as items are removed from the collection.
 				// Synchronize views as items are removed from the collection.
-				collection.on( 'remove', ( evt, item ) => {
+				this.listenTo( collection, 'remove', ( evt, item ) => {
 					this.remove( this._boundItemsToViewsMap.get( item ) );
 					this.remove( this._boundItemsToViewsMap.get( item ) );
 
 
 					this._boundItemsToViewsMap.delete( item );
 					this._boundItemsToViewsMap.delete( item );