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

error using cancel() #7

Closed
ray-5050 opened this issue Sep 18, 2018 · 1 comment
Closed

error using cancel() #7

ray-5050 opened this issue Sep 18, 2018 · 1 comment
Assignees

Comments

@ray-5050
Copy link

I would like to terminate or cancel an instant of an onTime so that I could programmically restart it using a different setting. Therefore, I tried using ot.cancel(); I assumed that is what this is for but was unsure.

As a test, I was using the ontime module to trigger every minute and when the minute >= ## then I called ot.cancel().
if(myMin >= 50) ot.cancel();

When I tried using this, I get the following error
/home/web/node_modules/ontime/index.js:209
cancelTimeout(then.timer)
ReferenceError: cancelTimeout is not defined

Ideally, I would like to kill an instance of onTime using the id and use it anywhere in the code with just ot.cancel(id);

Thanks for your help.

@mycoboco mycoboco self-assigned this Sep 19, 2018
@mycoboco mycoboco added the bug label Sep 19, 2018
@mycoboco
Copy link
Owner

mycoboco commented Sep 19, 2018

The reference error has been fixed and I've urgently published v0.0.6 with the fix.
I should have more exhaustively tested what might happen with single set to false.

I will consider the idea using an id to control timers with your idea suggested before.

Thank you very much for reporting the issue.

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

No branches or pull requests

2 participants