Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onTime functions #18

Open
nickpalenchar opened this issue Jan 16, 2021 · 0 comments
Open

onTime functions #18

nickpalenchar opened this issue Jan 16, 2021 · 0 comments

Comments

@nickpalenchar
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant