|
@@ -303,34 +303,32 @@ const ObservableMixin = {
|
|
|
*
|
|
*
|
|
|
* foo.method( 1, 2 ); // -> '3, 2'
|
|
* foo.method( 1, 2 ); // -> '3, 2'
|
|
|
*
|
|
*
|
|
|
- * @param {String} ...methodNames Names of the methods to decorate.
|
|
|
|
|
|
|
+ * @param {String} methodName Name of the method to decorate.
|
|
|
*/
|
|
*/
|
|
|
- decorate( ...methodNames ) {
|
|
|
|
|
- methodNames.forEach( methodName => {
|
|
|
|
|
- const originalMethod = this[ methodName ];
|
|
|
|
|
|
|
+ decorate( methodName ) {
|
|
|
|
|
+ const originalMethod = this[ methodName ];
|
|
|
|
|
|
|
|
- if ( !originalMethod ) {
|
|
|
|
|
- /**
|
|
|
|
|
- * Cannot decorate an undefined method.
|
|
|
|
|
- *
|
|
|
|
|
- * @error observablemixin-cannot-decorate-undefined
|
|
|
|
|
- * @param {Object} object The object on which you try to decorate a method.
|
|
|
|
|
- * @param {String} methodName Name of the method which does not exist.
|
|
|
|
|
- */
|
|
|
|
|
- throw new CKEditorError(
|
|
|
|
|
- 'observablemixin-cannot-decorate-undefined: Cannot decorate an undefined method.',
|
|
|
|
|
- { object: this, methodName }
|
|
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- this.on( methodName, ( evt, args ) => {
|
|
|
|
|
- evt.return = originalMethod.apply( this, args );
|
|
|
|
|
- } );
|
|
|
|
|
|
|
+ if ( !originalMethod ) {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Cannot decorate an undefined method.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @error observablemixin-cannot-decorate-undefined
|
|
|
|
|
+ * @param {Object} object The object which method should be decorated.
|
|
|
|
|
+ * @param {String} methodName Name of the method which does not exist.
|
|
|
|
|
+ */
|
|
|
|
|
+ throw new CKEditorError(
|
|
|
|
|
+ 'observablemixin-cannot-decorate-undefined: Cannot decorate an undefined method.',
|
|
|
|
|
+ { object: this, methodName }
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- this[ methodName ] = function( ...args ) {
|
|
|
|
|
- return this.fire( methodName, args );
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ this.on( methodName, ( evt, args ) => {
|
|
|
|
|
+ evt.return = originalMethod.apply( this, args );
|
|
|
} );
|
|
} );
|
|
|
|
|
+
|
|
|
|
|
+ this[ methodName ] = function( ...args ) {
|
|
|
|
|
+ return this.fire( methodName, args );
|
|
|
|
|
+ };
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|