@octokit/webhooks
Version:
GitHub webhook events toolset for Node.js
21 lines (20 loc) • 524 B
JavaScript
function removeListener(state, webhookNameOrNames, handler) {
if (Array.isArray(webhookNameOrNames)) {
webhookNameOrNames.forEach(
(webhookName) => removeListener(state, webhookName, handler)
);
return;
}
if (!state.hooks[webhookNameOrNames]) {
return;
}
for (let i = state.hooks[webhookNameOrNames].length - 1; i >= 0; i--) {
if (state.hooks[webhookNameOrNames][i] === handler) {
state.hooks[webhookNameOrNames].splice(i, 1);
return;
}
}
}
export {
removeListener
};