UNPKG

@nfid/identitykit

Version:

A React library for adding wallet connections to dApps.

39 lines (38 loc) 1.02 kB
/** @module IdleManager */ type TimeoutCB = () => unknown; export type TimeoutManagerOptions = { /** * Callback after the timeout */ onTimeout?: TimeoutCB; /** * timeout in ms */ timeout: number; }; /** * Detects if the `timeout` ms is over, and calls `onTimeout` and registered callbacks. * To override these defaults, you can pass an `onTimeout` callback, or configure a custom `timeout` in milliseconds */ export declare class TimeoutManager { callbacks: TimeoutCB[]; timeout?: TimeoutManagerOptions["timeout"]; timeoutID?: number; /** * @param options {@link IdleManagerOptions} */ constructor(options: TimeoutManagerOptions); /** * @param {TimeoutCB} callback function to be called on timeout */ registerCallback(callback: TimeoutCB): void; /** * Cleans up the timeout manager and its listeners */ exit(): void; /** * Resets the timeouts during cleanup */ _resetTimer(): void; } export {};