data-provider / core

Async data provider agnostic about data origins

Home Page:https://data-provider.javierbrea.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add more information to emitted events

javierbrea opened this issue · comments

It is desirable to add more details about current resource state when a change or changeAny event is emitted.
A new data property could be added to the emitted object in the case of changeAny event. This property should contain current values of loading, error and value.

For change events, that currently are emitting only the method name, this should be replaced by an object containing method and data properties, but this change implies a breaking change in the event interface, and this fact has to be taken into account before making the change ¿Does it really improve the interface enough to assume the risk of a breaking change? Maybe it has to implemented in the next major version.

This issue was originally created at XbyOrange/mercury#12. That project seems to be no longer maintained, so it should be fixed in this one.

In v2.0.0 event methods have been modified. Now only on, once, onChild and onceChild methods are available to add listeners. Further info is available at the [events docs page][https://www.data-provider.org/docs/api-events]. As arguments for the event listeners, only the eventName will be provided in case the listener has been added using an event name wildcard, and the "child" causing the event in case the event listener was added using one of the onChild or onceChild methods.