()
| 1 | const createSubmenuCtx = () => { |
| 2 | let timer, |
| 3 | count = 0; |
| 4 | return { |
| 5 | toggle: (isOpen) => { |
| 6 | isOpen ? count++ : count--; |
| 7 | count = Math.max(count, 0); |
| 8 | }, |
| 9 | on: (closeDelay, pending, settled) => { |
| 10 | if (count) { |
| 11 | if (!timer) |
| 12 | timer = setTimeout(() => { |
| 13 | timer = 0; |
| 14 | pending(); |
| 15 | }, closeDelay); |
| 16 | } else { |
| 17 | settled?.(); |
| 18 | } |
| 19 | }, |
| 20 | off: () => { |
| 21 | if (timer) { |
| 22 | clearTimeout(timer); |
| 23 | timer = 0; |
| 24 | } |
| 25 | } |
| 26 | }; |
| 27 | }; |
| 28 | |
| 29 | export { createSubmenuCtx }; |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…