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

Method setTimeout

packages/melonjs/src/system/timer.ts:137–153  ·  view source on GitHub ↗

* Calls a function once after a specified delay. See me.timer.setInterval to repeativly call a function. * @param fn - the function you want to execute after delay milliseconds. * @param delay - the number of milliseconds (thousandths of a second) that the function call should be delayed by. *

(
		fn: (...args: any[]) => any,
		delay: number,
		pauseable?: boolean,
		...args: any[]
	)

Source from the content-addressed store, hash-verified

135 * me.timer.setTimeout(myFunction, 1000, true, param1, param2);
136 */
137 setTimeout(
138 fn: (...args: any[]) => any,
139 delay: number,
140 pauseable?: boolean,
141 ...args: any[]
142 ) {
143 this.timers.push({
144 fn: fn,
145 delay: delay,
146 elapsed: 0,
147 repeat: false,
148 timerId: ++this.timerId,
149 pauseable: pauseable ?? true,
150 args: args,
151 });
152 return this.timerId;
153 }
154
155 /**
156 * Calls a function continously at the specified interval. See setTimeout to call function a single time.

Callers 4

clickedMethod · 0.80
clickedMethod · 0.80
timer.spec.jsFile · 0.80
dropMethod · 0.80

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected