The current spec for emit and invoke methods supports 2 args: type and ctx.
We should provide a third optional arg for a callback function which serves as an acknowledgement.
Why?
When I:
const client = new EventsClient();
client.emit("newEvent", { message: "hello world" })
I would like to pass a third callback arg:
client.emit("newEvent", { message: "hello world" }, ({ detail, error }) => {
if (error) {
// do stuff with error
} else {
// do stuff with information passed in the callback
console.log(`detail object from callback: ${detail}`)
}
})
Considering there could be more than one listener for newEvent, not sure how this would playout. Will do some research / exploration.
The current spec for
emitandinvokemethods supports 2 args:typeandctx.We should provide a third optional arg for a callback function which serves as an acknowledgement.
Why?
When I:
I would like to pass a third callback arg:
Considering there could be more than one listener for
newEvent, not sure how this would playout. Will do some research / exploration.