Browse Source

Other: Use spread operator for passed arguments in `DomEmitterMixin.listenTo`.

Maciej Gołaszewski 8 years ago
parent
commit
fc9a022c63
1 changed files with 4 additions and 4 deletions
  1. 4 4
      packages/ckeditor5-utils/src/dom/emittermixin.js

+ 4 - 4
packages/ckeditor5-utils/src/dom/emittermixin.js

@@ -51,19 +51,19 @@ const DomEmitterMixin = extend( {}, EmitterMixin, {
 	 *
 	 * @method module:utils/dom/emittermixin~EmitterMixin#listenTo
 	 */
-	listenTo( emitter, event, callback, options ) {
+	listenTo( emitter, ...rest ) {
 		// Check if emitter is an instance of DOM Node. If so, replace the argument with
 		// corresponding ProxyEmitter (or create one if not existing).
 		if ( isDomNode( emitter ) ) {
 			const proxy = this._getProxyEmitter( emitter ) || new ProxyEmitter( emitter );
 
-			proxy.attach( event, callback, options );
+			proxy.attach( ...rest );
 
 			emitter = proxy;
 		}
 
 		// Execute parent class method with Emitter (or ProxyEmitter) instance.
-		EmitterMixin.listenTo.call( this, emitter, event, callback, options );
+		EmitterMixin.listenTo.call( this, emitter, ...rest );
 	},
 
 	/**
@@ -100,7 +100,7 @@ const DomEmitterMixin = extend( {}, EmitterMixin, {
 		EmitterMixin.stopListening.call( this, emitter, event, callback );
 
 		if ( emitter instanceof ProxyEmitter ) {
-			emitter.detach( event, callback );
+			emitter.detach( event );
 		}
 	},