Inject a hook to a hot reloadable component so that
we can keep track of it.

@param {Object} options
@param {String} name
@param {Function} hook
429222
function injectHook(options, name, hook) {
  const existing = options[name]
  options[name] = existing
    ? Array.isArray(existing) ? existing.concat(hook) : [existing, hook]
    : [hook]
}
724920
def create_hook(hook_name)
      Overcommit::Hook.const_get(@context.hook_class_name).
                       const_get(hook_name).
                       new(@config, @context)
    rescue LoadError, NameError => error
      raise Overcommit::Exceptions::HookLoadError,
            "Unable to load hook '#{hook_name}': #{error}",
            error.backtrace
    end
207711
function option(name, type) {
  if (name[TYPICAL_TYPE]) {
    type = name;
    name = `${type.name}Option`;
  }

  /* istanbul ignore else */
  if (__DEV__) {
    assert(typeof name === 'string', `option()'s name must be a string`);
    assert(type[TYPICAL_TYPE], `option()'s type must be a type`);
  }

  const api = this;

  function Option(value, context) {
    if (Context.isRequired(context)) {
      return Context.with(value, Option, context, api);
    }

    return value == null ? context.toValue(value) : type(value, context);
  }

  return decorate(Option, name, option, type);
}
1359840
public function hook($name, $callable, $priority = 10)
    {
        if (!isset($this->hooks[$name])) {
            $this->hooks[$name] = array(array());
        }
        if (is_callable($callable)) {
            $this->hooks[$name][(int) $priority][] = $callable;
        }
    }
394341
function(module, name, args) {
      hook('evaluatingHookBody', module, name)
      try { return module[name].apply(module, args) }
      catch(e) { error('Error in hook ' + module.name + '.' + name + ': ', e) }
    }
651980
function hooks(compiler, options) {
  return Promise.resolve()
    .then(() => require('./HmrServer'))
    .then(({ default: HmrServer }) =>
      new HmrServer({
        ...options,
        compiler, // webpack compiler
      }).run()
    );
}
1355340
def hook(name=None, *args, **kwargs):
    
    def decorator(f):
        if not hasattr(f, "hooks"):
            f.hooks = []
        f.hooks.append((name or f.__name__, args, kwargs))
        return f
    return decorator
509469
function __hook(?string $actionName, Request $request, Response $response):?string
    {
        $actionName = $request->getMethod().ucfirst($actionName);
        return parent::__hook($actionName, $request, $response);
    }
552231
function(name){
        this.comboDatas.forEach(function(item, index){
            if(item.name === name){
                this.selectItem(index);
                return;
            }
        }.bind(this));
    }
517765
function (name, data, options) {
            var _listeners = this.__handlers__[name],
                _listener,
                _result = null;
            if (_listeners) {
                for (var i = 0, length = _listeners.length; i < length; i++) {
                    _listener = _listeners[i];
                    if (_listener && _listener.handler) {
                        if(options && options.method=='apply'){
                            _result = _listener.handler.apply(_listener.context || _listener.owner, data);
                        } else {
                            _result = _listener.handler.call(_listener.context || _listener.owner, _listener.owner, data, options);
                        }
                        if (false === _result) {
                            return false;
                        }
                    }
                }
            }

            return this;
        }
1212975
function CruxGithookComponent(__name) {
  Githook.super_.apply(this, arguments);
  this.name = (typeof __name === 'string' ? __name : 'redis');
  this.client = {};
}
318853
function addHookFn (proto, name) {
  proto[name] = function () {
    var args = [].splice.call(arguments, 0);

    var fn = args.splice(args.length - 1)[0];
    fn = _.isFunction(fn) ? fn : undefined;

    var options = {};
    if (_.isPlainObject(args[args.length - 1])) {
      options = args.splice(args.length - 1)[0];
    }

    var self = this;
    _.each(args, function(arg) {
      var event = util.format('%s.%s.%s.%s', name, self.name, self.version, arg);
      // remove old listeners if redefine is true
      if (options.redefine) {
        debug('Redefine hook', event);
        self.removeAllListeners(event);
      }
      self.on(event, fn);
    });
  };
}
422725
def trigger(self, name, *a, **ka):
        '''  '''
        hooks = self.hooks[name]
        if ka.pop('reversed', False): hooks = hooks[::-1]
        return [hook(*a, **ka) for hook in hooks]
1261488
function (hooks) {
        var obj = {};
        hooks.forEach(function (elements) {
            elements.forEach(function (item) {
                if (!obj[item.name]) {
                    obj[item.name] = item;
                }
            });
        });
        return obj;
    }
204585
def create_hook(self, name, config, events=github.GithubObject.NotSet, active=github.GithubObject.NotSet):
        
        assert isinstance(name, (str, unicode)), name
        assert isinstance(config, dict), config
        assert events is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in events), events
        assert active is github.GithubObject.NotSet or isinstance(active, bool), active
        post_parameters = {
            "name": name,
            "config": config,
        }
        if events is not github.GithubObject.NotSet:
            post_parameters["events"] = events
        if active is not github.GithubObject.NotSet:
            post_parameters["active"] = active
        headers, data = self._requester.requestJsonAndCheck(
            "POST",
            self.url + "/hooks",
            input=post_parameters
        )
        return github.Hook.Hook(self._requester, headers, data, completed=True)
761405
public function addHook(Hook $hook)
    {
        if (isset($this->hooks[$hook->name]) === false) {
            $this->logger->debug(
                "Adding definition for hook '{$hook->name}' for the first time."
            );
            $this->hooks[$hook->name] = [];
        }

        $this->hooks[$hook->name][] = $hook->definition;
    }
389403
def add_hook(self, hook):
        
        h = hook.hash
        self.hooks[h] = hook