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

emitting an event when status of timer changes #2

Merged
merged 4 commits into from
Nov 27, 2018

Conversation

jbbpatel94
Copy link
Contributor

No description provided.

@jbbpatel94
Copy link
Contributor Author

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
Copy link
Owner

@mathiasvr mathiasvr left a 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'
}
Copy link
Owner

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.

Copy link
Contributor Author

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) {
Copy link
Owner

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) {

Copy link
Contributor Author

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)
Copy link
Owner

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', ...)

Suggested change
this.emit('onChangeStatus', this._status)
this.emit('statusChanged', this._status)

Copy link
Contributor Author

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
@jbbpatel94
Copy link
Contributor Author

I updated as per your suggestions.

Thanks!

@mathiasvr mathiasvr merged commit 960c22a into mathiasvr:master Nov 27, 2018
@mathiasvr
Copy link
Owner

@jbbpatel94 Thanks for the quick fixes 👍

Released it as v1.3.0.

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

Successfully merging this pull request may close these issues.

2 participants