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

Documentation on using addEventListener(callback) #3

Closed
Bdog2g2 opened this issue Dec 27, 2013 · 2 comments
Closed

Documentation on using addEventListener(callback) #3

Bdog2g2 opened this issue Dec 27, 2013 · 2 comments

Comments

@Bdog2g2
Copy link

Bdog2g2 commented Dec 27, 2013

Great plugin and it nearly does what I need, but I don't quite follow how I'm supposed to attached the addEventListener(callback). I don't know what event I'm listening for since i'm waiting on TimeCircles object to finish.

For instance, I have an application where the user will start the timer, but I need to know when the timer is done to post a record or when x amount of time is left to play a sound.

I'm assuming I'd need to use this to "reset" the timer automatically after the time has expired.

Thanks.

@wimbarelds
Copy link
Owner

The lisener is called every single time a unit of time changes (seconds, minutes, hours, days).

To determine that time has run out, you would do something like:
$("#YourItem").TimeCircles().addListener(function(unit, amount, total){
if(total == 0) {
alert("Time has run out");
}
});

I would also recommend total to determine [x] amount of time is left. Total shows the total time in seconds until (or since) 0.

I'm not entirely sure what you mean by resetting the timer.

@Bdog2g2
Copy link
Author

Bdog2g2 commented Dec 28, 2013

Actually what you gave me was perfect.

I sort of had it the right idea, but just implemented wrong.

Thanks again for the plugin and the help.

@Bdog2g2 Bdog2g2 closed this as completed Dec 28, 2013
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

2 participants