-
Notifications
You must be signed in to change notification settings - Fork 10
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
emitting an event when status of timer changes #2
Conversation
emitting an event when status of timer changes this might helpful when we want to do something when timer status changes. |
emitting an event when status of timer changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I like this idea 👍
I have a couple of change requests that I hope you are good with.
src/index.js
Outdated
_stopped: 'stopped', | ||
_running: 'running', | ||
_paused: 'paused' | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a good idea to group possible status values,
but I would prefer to remove this for now.
I might do this with Typescript at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated as per your suggestions.
Thanks!
src/index.js
Outdated
this.changeStatus(status._running) | ||
} | ||
|
||
changeStatus (status) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add an underscore, to signal that this is an internal function:
_changeStatus (status) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated as per your suggestions.
Thanks!
src/index.js
Outdated
|
||
changeStatus (status) { | ||
this._status = status | ||
this.emit('onChangeStatus', this._status) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to rename the event, so it is attached by timer.on('statusChanged', ...)
this.emit('onChangeStatus', this._status) | |
this.emit('statusChanged', this._status) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated as per your suggestions.
Thanks!
updated as per suggestions
updated as per suggestion
I updated as per your suggestions. Thanks! |
@jbbpatel94 Thanks for the quick fixes 👍 Released it as |
No description provided.