MCPcopy Create free account
hub / github.com/effector/effector / handler

Function handler

src/forest/method/handler.ts:22–53  ·  view source on GitHub ↗
(options: any, map?: any)

Source from the content-addressed store, hash-verified

20 >,
21): void
22export function handler(options: any, map?: any) {
23 if (!currentTemplate) return
24 const draft = currentTemplate.draft
25 assert(
26 draft.type === 'element',
27 `"handler" extension can be used only with element nodes, got "${draft.type}"`,
28 )
29 if (map === undefined) {
30 map = options
31 options = {}
32 }
33 for (const key in map) {
34 assert(is.unit(map[key]), `handler for "${key}" should be event`)
35 }
36 const {
37 passive = false,
38 capture = false,
39 prevent = false,
40 stop = false,
41 } = options
42 draft.handler.push({
43 options: {
44 prevent,
45 stop,
46 },
47 domConfig: {
48 passive: prevent ? false : passive,
49 capture,
50 },
51 map,
52 })
53}

Callers 1

specFunction · 0.90

Calls 1

assertFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…