@rbxts/planck-hooks
Version:
A @rbxts/planck plugin that provides support for hooks.
14 lines (13 loc) • 594 B
TypeScript
/**
* Utility for easy time based intervalues.
*
* Accepts a duration and returns `true` if it has been that long since the last
* time this function returned `true`. Returns `false` the first time it is called.
*
* @param seconds - The number of seconds to throttle for.
* @param discriminator - An optional value to additionally key by.
* @param key - An automatically generated key to store the throttle state.
* @returns - Returns true every x seconds, otherwise false.
* @metadata macro
*/
export declare function useInterval(seconds: number, discriminator?: unknown): boolean;