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

Tidyup: Rewrite logic for sending messages with a timeout. #38

Open
cianmawhinney opened this issue Apr 19, 2024 · 0 comments
Open

Tidyup: Rewrite logic for sending messages with a timeout. #38

cianmawhinney opened this issue Apr 19, 2024 · 0 comments

Comments

@cianmawhinney
Copy link
Owner

cianmawhinney commented Apr 19, 2024

AbortSignal became available in Node in versions 15/17ish, which can simplify wrappers around methods which may need to be cancelled/aborted/timed out.

Tidy up logic in https://github.com/cianmawhinney/visca-camera-controller/blob/master/src/camera.js#L767-L813 by using an AbortSignal instead of the Promise.race.

Documentation for AbortSignal: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal#implementing_an_abortable_api

(I came across AbortSignal from this tweet: https://twitter.com/goenning/status/1781290404211814903)

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

No branches or pull requests

1 participant