function createCallback(method, defaultMethod = () => {}, canBeValue = false) {
    return function cb(...args) {
      const inDefinition = typeof definition[method] !== 'undefined';
      const inConfig = typeof config[method] !== 'undefined';

      let returnValue;
      if (inDefinition) {
        if (typeof definition[method] === 'function') {
          returnValue = definition[method].call(definitionContext, ...args);
        } else if (canBeValue) {
          returnValue = definition[method];
        }
      }

      if (inConfig) {
        if (typeof config[method] === 'function') {
          returnValue = config[method].call(instanceContext, ...args);
        } else if (canBeValue) {
          returnValue = config[method];
        }
      }

      if (!inDefinition && !inConfig) {
        returnValue = defaultMethod.call(definitionContext, ...args);
      }

      return returnValue;
    };
  }
// Create a callback that calls lifecycle functions in the definition and config (if they exist).
Create a callback that calls lifecycle functions in the definition and config (if they exist).
Create a callback that calls lifecycle functions in the definition and config ( if they exist ) .
function createCallback(method, defaultMethod = () => {}, canBeValue = false) {
    return function cb(...args) {
      const inDefinition = typeof definition[method] !== 'undefined';
      const inConfig = typeof config[method] !== 'undefined';
      let returnValue;
      if (inDefinition) {
        if (typeof definition[method] === 'function') {
          returnValue = definition[method].call(definitionContext, ...args);
        } else if (canBeValue) {
          returnValue = definition[method];
        }
      }
      if (inConfig) {
        if (typeof config[method] === 'function') {
          returnValue = config[method].call(instanceContext, ...args);
        } else if (canBeValue) {
          returnValue = config[method];
        }
      }
      if (!inDefinition && !inConfig) {
        returnValue = defaultMethod.call(definitionContext, ...args);
      }
      return returnValue;
    };
  }
function createCallback ( method , defaultMethod = ( ) => { } , canBeValue = false ) { return function cb ( ... args ) { const inDefinition = typeof definition [ method ] !== 'undefined' ; const inConfig = typeof config [ method ] !== 'undefined' ; let returnValue ; if ( inDefinition ) { if ( typeof definition [ method ] === 'function' ) { returnValue = definition [ method ] . call ( definitionContext , ... args ) ; } else if ( canBeValue ) { returnValue = definition [ method ] ; } } if ( inConfig ) { if ( typeof config [ method ] === 'function' ) { returnValue = config [ method ] . call ( instanceContext , ... args ) ; } else if ( canBeValue ) { returnValue = config [ method ] ; } } if ( ! inDefinition && ! inConfig ) { returnValue = defaultMethod . call ( definitionContext , ... args ) ; } return returnValue ; } ; }
Create a callback that calls lifecycle functions in the definition and config (if they exist).
Create a callback that calls lifecycle functions in the definition and config ( if they exist ) .