This library wraps JavaScript timers (timeout and interval) in a class to provide OOP way of using them.
import { Timeout } from 'oop-timers';
const timeout = new Timeout(() => console.log('Hello world!'), 1000);
timeout.start();
// Imagine UI with start and stop buttons and input for new timeout value :)
stopButton.addEventListener('click', () => timeout.stop());
startButton.addEventListener('click', () => timeout.start(Number(newTimeoutInput.value)));
Documentation can be found here: oop-timers documentation.
MIT