Skip to content
This repository was archived by the owner on Jul 28, 2024. It is now read-only.

Repository files navigation

Wavevision s.r.o.

Timer

CICoverage Statusnpm

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.

importtimerfrom'@wavevision/timer';timer(()=>alert('Time is up!'),1000);// this timer will be auto-startedtimer(()=>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)

About

⏱ Simple resumable timeout handler

Topics

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages