-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
feat(runtime): add Deno.addSignalListener API #12512
Conversation
runtime/js/40_signals.js
Outdated
} | ||
} | ||
} catch (e) { | ||
if (e instanceof errors.BadResource) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does BadResource
get thrown?
I think it could only happen if there is an error in the listener callback, in which case we should not be handling it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. This handling was unnecessary. Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM too, I like this API better; it will be useful for std/node
BTW, should we also stabilize it in 1.16? |
@kt3k please land ASAP as this PR will unblock polyfilling more |
Let's get some experience with it before we decide. |
This PR implements
Deno.addSignalListener
andDeno.removeSignalListener
APIs as disucessed in #11158The basic usage:
closes #11158