1.0.1 • Published 4 years ago

@wavevision/timer v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Build Status Coverage Status npm

Simple utility for creating resumable timeouts written in TypeScript. Works both in Node and browser environments.

Installation

Via Yarn

yarn add @wavevision/timer

or npm

npm install --save @wavevision/timer

Usage

Create your own timer.

import timer from '@wavevision/timer';

timer(() => alert('Time is up!'), 1000);
// this timer will be auto-started
timer(() => alert('Hello!'), 500, true);

The returned object exposes following functions:

  • clear(): void – clears the timeout
  • pause(): number – pauses the timeout, returns remaining time
  • remains(): number – returns remaining time
  • restart(): void – clears and starts the timeout over again
  • resume(): void – resumes the timeout (or starts if not running)
  • running(): boolean – returns whether the timeout is running at the moment
  • start(): void – starts the timeout (or resumes if paused)
1.0.1

4 years ago

1.0.0

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago