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

Open
CharlesRay opened this Issue Sep 18, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@CharlesRay

CharlesRay commented Sep 18, 2018

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

This comment has been minimized.

Show comment
Hide comment
@mycoboco

mycoboco Sep 19, 2018

Owner

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.

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