Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/07akioni/sstimer

A super simple timer that can start, stop & fire finish callback.
https://github.com/07akioni/sstimer

Last synced: 28 days ago
JSON representation

A super simple timer that can start, stop & fire finish callback.

Awesome Lists containing this project

README

        

# sstimer

## Usage

```js
import { createTimer } from "sstimer";

const timer = createTimer(
() => {
alert("Stop");
},
{
duration: 5000,
}
);

document.querySelector("button")?.addEventListener("click", () => {
if (timer.active) {
timer.stop();
} else {
timer.start();
}
});
```