Dynamically hooks the right webhook paths
165288
def hook_up(self, router: UrlDispatcher):
        

        router.add_get(self.webhook_path, self.check_hook)
        router.add_post(self.webhook_path, self.receive_events)
569304
function applyHooks(config, filename)
{
  // sort hooks short first + alphabetically
  Object.keys(this.hooks).sort(compareHooks).forEach(function(hook)
  {
    // in order to match hook should either the same length
    // as the filename or smaller
    if (filename.substr(0, hook.length) === hook)
    {
      config = this.hooks[hook].call(this, config);
    }
  }.bind(this));

  return config;
}
1141195
function addHook (hook) {
    /* Accepting a nodeback, promisify it; else, store as it */
    const pHook = (hook.length > 1) ? Promise.promisify(hook) : hook;
    G.hooks.push(pHook);
}
276794
protected function getHooksDirectorySetting() {
    // Set the module folder based on variable.
    $directory = $this->getSetting('data_directory', 'hooks');

    // Run it through version-specific stuff.
    // This basically prepends 'public://' or 'sites/default/files/'.
    $this->version_helper->directoryPath($directory);

    $this->hooks_directory = $directory;
  }
1139944
function verifyWebhook(hookDef, webhook) {
    logger(hookDef.name + ': Webhook already registered: ' + webhook.id + ': ' + webhook.status);
    if (webhook.status !== 'active') {
      logger(hookDef.name + ': Enabling webhook');
      webhooksClient.enable(webhook.id);
    }
  }
408595
function() {
			debug('next hook');
			var hook = global.requestSSLHooks[index++];
			if (hook) {
				debug('init hook',hook);
				// if async
				global.requestSSLInsideHook = true;
				if (hook.length > 0) {
					debug('calling a hook async');
					hook(nextHook);
					debug('after calling a hook async');
				}
				// else sync
				else {
					debug('calling a hook sync');
					hook();
					nextHook();
					debug('after calling a hook sync');
				}
				global.requestSSLInsideHook = false;
			}
			else {
				debug('init has no more hooks');
				done();
			}
		}
906802
def _run_hooked_methods(self, hook: str):
        
        for method in self._potentially_hooked_methods:
            for callback_specs in method._hooked:
                if callback_specs['hook'] != hook:
                    continue

                when = callback_specs.get('when')

                if when:
                    if self._check_callback_conditions(callback_specs):
                        method()
                else:
                    method()
95968
function hooks(vNode, patch, index) {
    if (isVNode(vNode)) {
        if (vNode.hooks) {
            patch[index] = new VPatch(VPatch.PROPS, vNode.hooks, vNode.hooks)
        }

        if (vNode.descendantHooks) {
            var children = vNode.children
            var len = children.length
            for (var i = 0; i < len; i++) {
                var child = children[i]
                index += 1

                hooks(child, patch, index)

                if (isVNode(child) && child.count) {
                    index += child.count
                }
            }
        }
    }
}
655160
def _register_webhook(self, webhook_url, events):
        """"""
        response = self._request(
            MINUT_WEBHOOKS_URL,
            request_type='POST',
            json={
                'url': webhook_url,
                'events': events,
            },
        )
        return response
1344754
async function runGitHook(config, hookType) {
    if (!(config instanceof Object)) {
        throw new TypeError("Value of argument \"config\" violates contract.\n\nExpected:\nObject\n\nGot:\n" + _inspect(config));
    }

    if (!hookName(hookType)) {
        throw new TypeError("Value of argument \"hookType\" violates contract.\n\nExpected:\nhookName\n\nGot:\n" + _inspect(hookType));
    }

    let err;
    let output;

    // Pre-commit hook handler
    // Note: it may be that the only thing which changes for non pre-commit usage is the cmd to run to get the files
    // Note: It might be worth splitting this out into another function if we add other handlers
    if (hookType === "pre-commit") {
        try {
            const rawFilesList = await exec(config.gitStatusCmd, config.execOptions);

            if (rawFilesList.stderr != "") {
                err = rawFilesList.stderr;
            } else if (rawFilesList.stdout != "") {
                const filteredFiles = await filterFilesList(rawFilesList.stdout, config.ignoreGitStatusResultPrefixes, _os.EOL);

                if (filteredFiles.size > 0) {
                    const violations = await scanFilteredFiles(filteredFiles, config.fileContentRegexps, config.violatingFilenameExtensions, config.filesToIgnore);

                    if (violations) {
                        output = await formatOutput(config.violationsMessageHeader, violations, config.violationsMessageFooter);
                    }
                }
            }
        } catch (e) {
            err = e;
        }
    }

    const p = new Promise((resolve, reject) => {
        // We only reject the promise if there is an actual error...
        // ...we don't reject on finding violating files, that will be handled in the pre-commit script
        if (err) {
            reject(err);
        } else {
            resolve(output);
        }
    });

    return p;
}
398764
private static void runHooks() {
        for (int i=0; i < MAX_SYSTEM_HOOKS; i++) {
            try {
                Runnable hook;
                synchronized (lock) {
                    // acquire the lock to make sure the hook registered during
                    // shutdown is visible here.
                    currentRunningHook = i;
                    hook = hooks[i];
                }
                if (hook != null) hook.run();
            } catch(Throwable t) {
                if (t instanceof ThreadDeath) {
                    ThreadDeath td = (ThreadDeath)t;
                    throw td;
                }
            }
        }
    }
59750
public function webhook(): void
	{
		//$log = new Logger('botlog');
		//$log->pushHandler(new StreamHandler(__DIR__ . "/../log/botlog.log", Logger::DEBUG));

		if ($data = BotApi::jsonValidate(file_get_contents('php://input'), true)) {
			//$log->debug(file_get_contents('php://input'));
			$update = Update::fromResponse($data);
			$this->processUpdate($update);
		}
	}
716475
function _hook(slf, name, handlerInfo, params) {
  if (!slf.__hooks[name]) return;

  slf.__hooks[name].forEach(function (hook) {
    hook(handlerInfo, params);
  });
}
81836
def run_hook(hook_name, *args, &block)
      hooks.find {|hook| hook.name == hook_name }.run(self, *args, &block)
    end
706576
def _init_request_hooks(self):
        
        for method_type in ('pre', 'post'):
            for method in _METHODS:
                event = getattr(self.app, 'on_' + method_type + '_' + method)
                event_hook = getattr(hooks, method_type + '_' + method)
                event += event_hook
936668
def start_webhook(self, webhook_path=None, request_handler=WebhookRequestHandler, route_name=DEFAULT_ROUTE_NAME,
                      **kwargs):
        
        self.set_webhook(webhook_path=webhook_path, request_handler=request_handler, route_name=route_name)
        self.run_app(**kwargs)
316540
function addHook($type, $func, $prepend = false, $subtype = false)
    {
        if ($subtype)
        {
            if ($prepend)
            {
                array_unshift($this->hooks[$type][$subtype], $func);
            }
            else
            {
                $this->hooks[$type][$subtype][] = $func;
            }
        }
        else
        {
            if ($prepend)
            {
                array_unshift($this->hooks[$type], $func);
            }
            else
            {
                $this->hooks[$type][] = $func;
            }
        }
    }