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

Method setInterval

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

* Calls a function continously at the specified interval. See setTimeout to call function a single time. * @param fn - the function to execute * @param delay - the number of milliseconds (thousandths of a second) on how often to execute the function * @param [pauseable] - respects the pause s

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

Source from the content-addressed store, hash-verified

166 * me.timer.setInterval(myFunction, 1000, true, param1, param2);
167 */
168 setInterval(
169 fn: (...args: any[]) => any,
170 delay: number,
171 pauseable?: boolean,
172 ...args: any[]
173 ) {
174 this.timers.push({
175 fn: fn,
176 delay: delay,
177 elapsed: 0,
178 repeat: true,
179 timerId: ++this.timerId,
180 pauseable: pauseable === true || true,
181 args: args,
182 });
183 return this.timerId;
184 }
185
186 /**
187 * Cancels a timeout previously established by calling setTimeout().

Callers 2

timer.spec.jsFile · 0.80
onActivateEventMethod · 0.80

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected