MCPcopy Create free account
hub / github.com/melonjs/melonJS / defer

Function defer

packages/melonjs/src/utils/function.ts:23–29  ·  view source on GitHub ↗
(
	func: (...args: TArgs) => unknown,
	thisArg: unknown,
	...args: TArgs
)

Source from the content-addressed store, hash-verified

21 * me.utils.function.defer(myFunc, this, 1, 2, 3);
22 */
23export function defer<TArgs extends unknown[]>(
24 func: (...args: TArgs) => unknown,
25 thisArg: unknown,
26 ...args: TArgs
27) {
28 return setTimeout(func.bind(thisArg), 0, ...args);
29}
30
31/**
32 * returns a function that, when invoked will only be triggered at most once during a given window of time

Callers 6

onCompleteFunction · 0.90
changeFunction · 0.90
clearTimeoutMethod · 0.90
clearIntervalMethod · 0.90
removeChildMethod · 0.90
sortMethod · 0.90

Calls 1

bindMethod · 0.45

Tested by

no test coverage detected