hoodiehq / hoodie-client

:dog: Client API for the Hoodie server
Apache License 2.0
34 stars 25 forks source link

Arguments ignored in custom events #156

Closed gnowoel closed 7 years ago

gnowoel commented 7 years ago

From the docs, the signature of the hoodie.trigger() method is:

hoodie.trigger(eventName[, option1, option2, ...])

However, the optional arguments are simply ignored in the implementation:

state.emitter.emit(eventName)

In effect, when we trigger a custom event with:

hoodie.trigger('name', object);

The passed-in object will always be undefined in the event handler:

hoodie.on('name', (object) => {
  console.log(object); //=> undefined
});
gr2m commented 7 years ago

You are right 👍 That’s a proper bug. Would you mind sending a pull request to fix it? Happy to assist if you have any questions

gnowoel commented 7 years ago

Sure, would be glad to help :)