Releases: cayasso/primus-emitter
Compatible with Primus 2.x.x
As most of you know, [email protected] is out with some great updates and some breaking plugin changes, this release 3.0 address these breaking changes.
No more event blacklist to support.
primus-emitter
uses now the reserved
method exposed by Primus on the client, spark and server. Before this method, a black list of reserved events was needed, making it difficult to maintain specially when new events were introduced to a plugin (for example primus-rooms
) or Primus. Plugins now can add their custom events to the primus.reserved.events
object making it easier to check by other plugins using this new reserved
method.
Compatibility with Primus initialisation method
Another change introduced in the latest Primus version is that Sparks properties are no longer writable but are readable, this restricts overwriting prototype methods like Spark.prototype.initialise
which in this case was used by primus-emitter
for initializing the Emitter
instance on the Spark
, at the moment it was the simplest way I found to do this task however this commit primus/primus@081fc60 allow using the initialisation
without overwriting the main private one by Primus
.
Note on version 2.1.0
Version 2.1.0
is not fully compatible with previous Primus versions like [email protected], this version will only work on [email protected] check this issue for a better understanding #20
Thanks
Again to all of you who collaborated on this version, specially @lpinca and @3rd-Eden.
Changelog
- [release] 3.0.0
- [doc] Updating readme with version 3.0.0 notice #20
- [doc] Primus 2.0.0 compatibility notice
- [release] 2.1.0
- [minor] Testing against Primus master branch
- [major] Using Spark.readable and preparing for comming primus-rooms version
- [minor] Fixing Travis CI build error
- [test] Adjusting and adding tests to conform to Primus 2.x.x changes
- [doc] Primus 2.0.0 compatibility notice
- Merge pull request #18 from lpinca/remove/event-blacklist
- [minor] Reapplying
ondata
function name and removing reserved events test - Revert "[minor] Adding custom reserved events"
- [minor] Removing some silly test code
- [minor] Adding custom reserved events
- Merge pull request #17 from 3rd-Eden/patch-1
- [fix] Do the reserved check on the receiving end of the event
- [minor] removing test argument
- Removing black list
- [minor] use new Primus initialise and reserved methods
- Merge pull request #15 from lpinca/fix/reserved-event
- [fix] Adding the newly introduced
readyStateChange
event to the blacklist - [test] Updating package.json
Use the latest 3.x.x instead of this version
Special Note
Version 2.1.0
is not fully compatible with previous Primus versions like [email protected], this version will only work on [email protected], check this issue for a better understanding #20
If you are using [email protected] then you can continue using [email protected]
.
For [email protected]
the best choice is to use the latest [email protected]
Thanks!
Maintenance release, reserved events refactoring
Broadcast with primus.send & ignoring reserved events
This release is quick and dirty, it adds primus.send
method to broadcast events from server to clients issue #8. This release also add a fix for ignoring reserved primus
events. issue #7.
Thanks to @lpinca and @tstrimple who reported these needed changes.
JB
Normalize global $.emitter namespace
This release add some changes to normalize the emitter name space, the $
is used as a way to access the plugins namespaces directly, using the built-in primus.plugin('emitter')
to obtain the plugin is a very handy alternative but if someone declare the plugin with a different name like primus.use('my-emitter', 'primus-emitter')
, this will make the other plugins like primus-multiplex
, primus-rooms
fail to recognize it, so as a way to avoid this issue the $
is used, ensuring that we will always get the right plugin event if it was declared with a different name.
Cheers,
JB
Replacing emit with send
As off version 2+ the emit
method will no longer be supported, instead use the send
method, this is because emit
is widely used by Primus for internal events, so this required some hacks and also an event blacklist to maintain for avoiding event collisions, for the sake of simplicity and the sake of maintainability I decided to drop the method, the new method send
works the same as emit
, and it removes hacks and the old event blacklist to support.
Because of this change, primus-emitter
2.0 might not work well with versions 1.x of primus-rooms
and primus-multiplex
, these modules will be updated to 2.x version making them also compatible with this version.
You can always go back and install the previous version if you really need to.
$ npm install [email protected]