goodtimer
goodtimer copied to clipboard
`onTime` functions
functions fire on onTimeout
and onInterval
, but OnTime
should be added to allow users to add arbitrary events whenever they please.
As TimerOptions
new Timer("5:00", {
onTime: {
"2:00": showRunningLowOnTime,
"0:30": showVeryRunningLowOnTime
}
});
As a method on a timer
const timer = new Timer("5:00");
timer.onTime("2:00", showRunningLowOnTime);
timer.onTime("0:30", showVeryRunningLowOnTime);
```js
## clearing `onTime` events.
```js
timer.clearOnTime("2:00");
// returns: true if a function existed and was removed, false otherwise
Changes
This effectively makes onTimeout
a function for { onTime: "0:00" }
, and should be refactored as such.