Closed raix closed 9 years ago
I'm not familiar with cordova and frankly didn't get what you've said. How about some code example?
On Mon, Mar 16, 2015 at 2:58 PM Morten N.O. Nørgaard Henriksen < notifications@github.com> wrote:
We lack an emitter to simulate a state an example could be the cordova ready event where we want to be notified when a state changes, if a state is already set we will run the listener at registration.
Another use case is for the raix:push package where a push message can be set before Meteor is even ready/after ready etc. So the message can be interpreted as a state, eg. we want to get the state and updates.
cc: @arunoda https://github.com/arunoda (If you have input or opinion about this)
— Reply to this email directly or view it on GitHub https://github.com/raix/Meteor-EventEmitter/issues/9.
:) fair enough
var em = new EventEmitter();
em.addListener('ready', function() {
// I'm waiting on the ready state
});
// Emit a ready state - additional data is optional
em.emitState('ready');
em.addListener('ready', function() {
// I'll just run since the ready state is already triggered
});
Okay. got it. Then I think, it's better we build it as a separate package.
I know, it can be useful for a lot of places. For example, when creating ready callbacks and so on.
May be you can use this package behind the scene.
On Mon, Mar 16, 2015 at 3:03 PM Morten N.O. Nørgaard Henriksen < notifications@github.com> wrote:
:) fair enough
var em = new EventEmitter();
em.addListener('ready', function() { // I'm waiting on the ready state });
// Emit a ready state - additional data is optional em.emitState('ready');
em.addListener('ready', function() { // I'll just run since the ready state is already triggered });
— Reply to this email directly or view it on GitHub https://github.com/raix/Meteor-EventEmitter/issues/9#issuecomment-81538835 .
yep, good point - might be best to keep this package as clean as possible - maybe I'll add a eventState package instead, thanks!
We lack an emitter to simulate a
state
an example could be the cordova ready event where we want to be notified when a state changes, if a state is already set we will run the listener at registration.Another use case is for the
raix:push
package where a push message can be set before Meteor is even ready/after ready etc. So the message can be interpreted as a state, eg. we want to get the state and updates.cc: @arunoda (If you have input or opinion about this)