-
Notifications
You must be signed in to change notification settings - Fork 25
Description
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
});