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

toggle pause/resume? #23

Open
mauriciopasquier opened this issue Nov 2, 2013 · 3 comments
Open

toggle pause/resume? #23

mauriciopasquier opened this issue Nov 2, 2013 · 3 comments

Comments

@mauriciopasquier
Copy link

Is there a way to toggle state, instead of calling 'pause' or 'resume' alternatively? I want to avoid that logic if possible.

Also, I couldn't find a getter for the current state (paused or not). Is there any? Am I missing something?

I'd like to contribute this .countdown('toggle') but my javascriptfoo is really poor and there are no tests.. I'm afraid of breaking something :P

@kbwood
Copy link
Owner

kbwood commented Nov 3, 2013

There is no method to toggle the state, since there are two hold states: 'pause' and 'lap'. There is an internal field on the instance object that shows the hold state: inst._hold, but nothing exposed directly.

@kbwood kbwood closed this as completed Nov 3, 2013
@mauriciopasquier
Copy link
Author

What about something like this?

.countdown('toggle') // pause - resume
.countdown('toggle', 'lap') // lap - resume

So I'm thinking it only needs to wrap the current methods, and fire them based on inst._hold, right?

@kbwood kbwood reopened this Nov 4, 2013
@kbwood
Copy link
Owner

kbwood commented Nov 4, 2013

Or 'toggle' and 'lapToggle' maybe.

Yes, toggling based on inst._hold should work.

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