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

Various Non-Breaking Enhancements #8

Merged
merged 2 commits into from
Dec 21, 2018
Merged

Various Non-Breaking Enhancements #8

merged 2 commits into from
Dec 21, 2018

Conversation

dawsontoth
Copy link
Contributor

  1. The public methods are now all fluent, so you can chain method calls: emitter.me().subscribe(EmitterEvents.me, me => console.log(me)) etc.
  2. The internal utility methods now appear at the bottom of the class definition, making it a bit easier to understand the implementation.
  3. A event enumeration is now exposed, making it possible to use strong typing for the on method, as well as the new off method.
  4. Added off to make event removal possible.
  5. Added support for multiple callbacks per event.
  6. Renamed the internal method logError to _throwError to better describe what it does.
  7. Updated the on parameter check to accurately describe all possible events (calculated from the new enum so it doesn’t go out of style easily again)
  8. Made consistent usage of double quotes across the file, which seemed to be the predominant pattern in place already.
  9. Made other minor consistency fixes with whitespace, and added a .editorconfig to increate likelihood of future collaborator IDE cooperation.

Added .editorconfig with settings that match the majority of the codebase, fixed diversions where appropriate.
1. The public methods are now all fluent, so you can chain method calls: `emitter.me().subscribe(EmitterEvents.me, me => console.log(me))` etc.
2. The internal utility methods now appear at the bottom of the class definition, making it a bit easier to understand the implementation.
3. A event enumeration is now exposed, making it possible to use strong typing for the `on` method, as well as the new `off` method.
4. Added `off` to make event removal possible.
5. Added support for multiple callbacks per event.
6. Renamed the internal method logError to _throwError to better describe what it does.
7. Updated the `on` parameter check to accurately describe all possible events (calculated from the new enum so it doesn’t go out of style easily again)
8. Made consistent usage of double quotes across the file, which seemed to be the predominant pattern in place already.
9. Made other minor consistency fixes with whitespace.
@dawsontoth
Copy link
Contributor Author

I thought I'd contribute some of the tweaks I believe would make the JS library a bit more useful, and cleaned some stuff up while I was in there. Let me know if this is too aggressive of a pull request, and I can dial back any and/or all changes. I also have a Angular TypeScript version I could provide, but I suspect that'd merit a new repository.

@kelindar
Copy link
Contributor

Looks great! Thanks for the PR

@Florimond Florimond merged commit 62f4d9f into emitter-io:master Dec 21, 2018
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.

3 participants