src/core/a-register-element.js
function wrapMethod (obj, methodName, derivedObj, baseObj) {
  var derivedMethod = derivedObj[methodName];
  var baseMethod = baseObj[methodName];

  // Derived prototype does not define method, no need to wrap.
  if (!derivedMethod || !baseMethod) { return; }

  // Derived prototype doesn't override the one in the base one, no need to wrap.
  if (derivedMethod === baseMethod) { return; }

  // Wrap to ensure the base method is called before the one in the derived prototype.
  obj[methodName] = {
    value: function wrappedMethod () {
      baseMethod.apply(this, arguments);
      return derivedMethod.apply(this, arguments);
    },
    writable: window.debug
  };
}
function wrapMethod (obj, methodName, derivedObj, baseObj) {
  var derivedMethod = derivedObj[methodName];
  var baseMethod = baseObj[methodName];

  // Derived prototype does not define method, no need to wrap.
  if (!derivedMethod || !baseMethod) { return; }

  // Derived prototype doesn't override the one in the base one, no need to wrap.
  if (derivedMethod === baseMethod) { return; }

  // Wrap to ensure the base method is called before the one in the derived prototype.
  obj[methodName] = {
    value: function wrappedMethod () {
      baseMethod.apply(this, arguments);
      return derivedMethod.apply(this, arguments);
    },
    writable: window.debug
  };
}
function wrapMethod ( obj , methodName , derivedObj , baseObj ) { var derivedMethod = derivedObj [ methodName ] ; var baseMethod = baseObj [ methodName ] ; // Derived prototype does not define method, no need to wrap. if ( ! derivedMethod || ! baseMethod ) { return ; } // Derived prototype doesn't override the one in the base one, no need to wrap. if ( derivedMethod === baseMethod ) { return ; } // Wrap to ensure the base method is called before the one in the derived prototype. obj [ methodName ] = { value : function wrappedMethod ( ) { baseMethod . apply ( this , arguments ) ; return derivedMethod . apply ( this , arguments ) ; } , writable : window . debug } ; }
Wrap one method to ensure that the one in the base prototype is called before
the one in the derived one.

@param {object} obj - Object that will contain the wrapped method.
@param {string} methodName - The name of the method that will be wrapped.
@param {object} derivedObject - Object that inherits from the baseObj.
@param {object} baseObj - Object that derivedObj inherits from.
Wrap one method to ensure that the one in the base prototype is called before the one in the derived one .