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

Adding and removing event listeners #20

Open
stylesuxx opened this issue Mar 22, 2021 · 1 comment · May be fixed by #22
Open

Adding and removing event listeners #20

stylesuxx opened this issue Mar 22, 2021 · 1 comment · May be fixed by #22

Comments

@stylesuxx
Copy link

In the "real" Web Serial API it is possible to add and remove Event listener that listen on the connect and disconnect events:

serial.addEventListener('connect', connectHandler);
serial.addEventListener('disconnect', disconnectHandler);

The disconnect listener is IMHO especially important, so that one can clean up after the device has been disconnected.

@stylesuxx
Copy link
Author

@reillyeon I just checked - navigator.usb also allows to add and remove listeners, so this could just be passed through from what I understand.

If you like, I can implement that and submit a PR, I am just asking since I saw you already fixed #19 yesterday and thought maybe you have the listener changes stashed away and ready to submit ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant