Skip to content
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

Add Listeners API #10

Merged
merged 5 commits into from
Aug 24, 2022
Merged

Add Listeners API #10

merged 5 commits into from
Aug 24, 2022

Conversation

Zsailer
Copy link
Member

@Zsailer Zsailer commented Aug 11, 2022

Fixes #7

Add a simple API for "listening" to events and triggering a callback function when an event happens. The API is particularly useful for extension/plugin authors who might trigger extra logic when an event fires.

This could be achieved by adding a handler and routing it to some stream, then listening to that stream. But that is quite complicated for most usecases. Also, handlers are really reserved for consumers of the eventloggers parent application. This listeners API is meant to be used by extension authors looking to hook into events and extend them.

Todo:

  • Unit tests
  • Documentation

@Zsailer Zsailer added the enhancement New feature or request label Aug 11, 2022
jupyter_events/logger.py Outdated Show resolved Hide resolved
@Zsailer
Copy link
Member Author

Zsailer commented Aug 16, 2022

This is ready for a review 😎. This should be merged after #12 and will need to be rebased before merging. Otherwise, the main logic is in place.

@Zsailer Zsailer force-pushed the listener branch 2 times, most recently from 5d89bb9 to 3d78feb Compare August 18, 2022 14:57
jupyter_events/logger.py Outdated Show resolved Hide resolved
Copy link
Contributor

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Zsailer
Copy link
Member Author

Zsailer commented Aug 24, 2022

Thanks! Merging!

@Zsailer Zsailer merged commit 9464603 into jupyter:main Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: add API for event listeners
3 participants