MCPcopy
hub / github.com/react-dnd/react-dnd / onlyOnce

Function onlyOnce

packages/dnd-core/src/__tests__/DragDropMonitor.spec.ts:18–26  ·  view source on GitHub ↗
(cb: (...args: unknown[]) => void)

Source from the content-addressed store, hash-verified

16import * as Types from './types.js'
17
18const onlyOnce = (cb: (...args: unknown[]) => void) => {
19 let triggered = false
20 return (...args: unknown[]) => {
21 if (!triggered) {
22 triggered = true
23 cb(...args)
24 }
25 }
26}
27describe('DragDropMonitor', () => {
28 let manager: DragDropManager
29 let backend: ITestBackend

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…