Skip to content

Event emitter acknowledgements #18

@ahoward2

Description

@ahoward2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions