import { Optional } from "../lang-utils/core"; import { Option } from "../lang-utils/rust-lang-utils"; import { Counter } from "./counter"; import { State, TimerTickFn } from "./externals"; import { TimerInternal } from "./internals"; export declare const NoDuration = -1; export declare class TimerImpl implements TimerInternal { readonly name: string; readonly delayMs: number; readonly durationMs: number; readonly counter?: Counter | undefined; /** * Node.js uses Timeout and browser uses number. ReturnType handles this 🎉. * * More info: * - https://tinyurl.com/y2bssbfr * - https://stackoverflow.com/a/56970244/2085356 * @private */ private timerHandle?; private _state; private _onTickFn; private _onStopFn; private _onStartFn; constructor(name: string, delayMs: number, durationMs?: number, counter?: Counter | undefined); getOnStopFn(): Option; setOnStopFn(fn: Optional): void; getOnStartFn(): Option; setOnStartFn(value: Optional): void; getOnTickFn(): Option; setOnTickFn(fn: Optional): void; /** * Computes the new state using `TimerReducer.reducerFn` and puts it `this.state` property. * @param action if not provided compute initial state, else use it to get new state * @return new state object */ private dispatch; startTicking: () => this; stopTicking: () => this; get isStopped(): boolean; get isRunning(): boolean; get isCreatedAndNotStarted(): boolean; get state(): State; actuallyStart: () => void; actuallyStop: () => void; toString: () => string; }