-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Event listening support #3
Comments
On second thought... maybe the It looks like there are several event emitters already available too... making less code we'd have to maintain. Here's a library that already does event handling that we can simply integrate... https://github.com/scottcorgan/tiny-emitter - super small and has a |
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 invokedUsing 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.
The text was updated successfully, but these errors were encountered: