Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { EventEmitter } from 'events';
- declare enum TimerStatuses {
- Tick = 'tick',
- Done = 'done',
- StatusChanged = 'statusChanged',
- }
- declare namespace tinytimerjs {
- class Timer extends EventEmitter {
- /** Create a new Timer. Interval defaults to 1000. Stopwatch defaults to false. */
- constructor(options: {
- interval?: number,
- stopwatch?: boolean,
- });
- /** The time remaining. If stopped, returns 0. If paused but without the pause time, returns the current datetime. */
- time: number;
- /** The duration of the timer. Returns 0 if stopped. */
- duration: number;
- /** The status of the timer. */
- status: TimerStatuses;
- /** Start the timer with the provided duration and interval. Interval defaults to interval provided in constructor. */
- start(duration: number, interval?: number): void;
- /** Stop the timer. */
- stop(): void;
- /** Pause the timer. */
- pause(): void;
- /** Resume the timer. */
- resume(): void;
- }
- }
- export = tinytimerjs;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement