packages/js-toolkit/abstracts/Base/utils.js
/**
 * Call the given method while applying the given arguments.
 *
 * @param {Base}   instance The Base instance on which to trigger the method.
 * @param {String} method   The method to call.
 * @param {...any} args     The arguments to pass to the method.
 */
Call the given method while applying the given arguments.
@param {Base}   instance The Base instance on which to trigger the method.
@param {String} method   The method to call.
@param {...any} args     The arguments to pass to the method.
Call the given method while applying the given arguments . @param { Base } instance The Base instance on which to trigger the method . @param { String } method The method to call . @param { ... any } args The arguments to pass to the method .
function callMethod(instance, method, ...args) {
  if (__DEV__) {
    debug(instance, 'callMethod', method, ...args);
  }
  if (
    (method === 'destroyed' && !instance.$isMounted) ||
    (method === 'mounted' && instance.$isMounted)
  ) {
    if (__DEV__) {
      debug(instance, 'not', method, 'because the method has already been triggered once.');
    }
    return instance;
  }
  instance.$emit(method, ...args);
  if (!hasMethod(instance, method)) {
    return instance;
  }
  instance[method].call(instance, ...args);
  if (__DEV__) {
    debug(instance, method, instance, ...args);
  }
  return instance;
}
function callMethod ( instance , method , ... args ) { if ( __DEV__ ) { debug ( instance , 'callMethod' , method , ... args ) ; } if ( ( method === 'destroyed' && ! instance . $isMounted ) || ( method === 'mounted' && instance . $isMounted ) ) { if ( __DEV__ ) { debug ( instance , 'not' , method , 'because the method has already been triggered once.' ) ; } return instance ; } instance . $emit ( method , ... args ) ; if ( ! hasMethod ( instance , method ) ) { return instance ; } instance [ method ] . call ( instance , ... args ) ; if ( __DEV__ ) { debug ( instance , method , instance , ... args ) ; } return instance ; }
Call the given method while applying the given arguments.
Call the given method while applying the given arguments .
// Prevent duplicate call of `mounted` and `destroyed` // methods based on the component status // We always emit an event, but we do not call the method if it does not exist