Raiondesu / eventhoven

Event manager that composes events effortlessly 🎵
https://www.npmjs.com/package/eventhoven
MIT License
5 stars 1 forks source link

Provide array of results to event handler context #50

Open Raiondesu opened 4 years ago

Raiondesu commented 4 years ago

Is your feature request related to a problem? Please describe. Current way of result handling in emitters and handlers is half-baked - handlers can return data to emitters, but they do not have any knowledge or control on how this data is processed or handled.

Describe the solution you'd like Provide a new property to the event context - a typed results array that contains all the results of all previous handler's execution.

Example

on(someMap)('someEvent')(ctx => {
    const isMyHandlerFirst = ctx.results.length === 0;
})
Raiondesu commented 4 years ago

I guess this is heavily dependent on #49.