MCPcopy Create free account
hub / github.com/violentmonkey/violentmonkey / hook

Function hook

src/common/index.js:31–34  ·  view source on GitHub ↗
(cb)

Source from the content-addressed store, hash-verified

29 const hooks = new Set();
30 return {
31 hook(cb) {
32 hooks.add(cb);
33 return () => hooks.delete(cb);
34 },
35 fire(...data) {
36 // Set#forEach correctly iterates the remainder even if current callback unhooks itself
37 hooks.forEach(cb => cb(...data));

Callers

nothing calls this directly

Calls 1

addMethod · 0.80

Tested by

no test coverage detected