Skip to content

Event listening support #3

@mikesir87

Description

@mikesir87

Would be nice to allow me to hook in functions to hear and act on various events (like newly exposed/removed ports). There's a few ways this could be done, so figured I'd start the discussion.

What I'd like to propose is API similar to this...

pwd.on('event-name', cbFunction) => Function - returned function removes the listener when invoked

Using this approach, I can add an arbitrary number of listeners at any point in time, making it easy to add new plugins, etc.

This issue is more about plugging in the event API and not adding a particular event hook yet, as I feel those should be separate issues and keeps this discussion more focuses. Thoughts?

Example

The parameters are ones I just picked and would be dependent on the actual event being published.

pwd.on('instance.ports.new', function(instanceMetaData, port, url) {
  // Add a button that will display the port and open the url when clicked
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions