throttle
@zylem/game-lib / actions / throttle
Function: throttle()
throttle(
opts):ThrottleAction
Defined in: packages/game-lib/src/lib/actions/persistent-actions.ts:25
A repeating timer that becomes ready every N milliseconds.
Register with entity.action(throttle(...)).
Parameters
opts
Returns
ThrottleAction
Example
const t = entity.action(throttle({ duration: 500 }));
entity.onUpdate(() => {
if (t.ready) { t.consume(); // do something every 500ms }
});