Explorar o código

Code refactoring in ViewCollection class.

Aleksander Nowodzinski %!s(int64=9) %!d(string=hai) anos
pai
achega
de2dde600b
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  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.
-				collection.on( 'add', ( evt, item, index ) => {
+				this.listenTo( collection, 'add', ( evt, item, index ) => {
 					this.add( createView( item ), index );
 				} );
 
 				// 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._boundItemsToViewsMap.delete( item );