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

Feature request: Support "once" property when registering callbacks #23140

Open
slowriot opened this issue Dec 12, 2024 · 0 comments
Open

Feature request: Support "once" property when registering callbacks #23140

slowriot opened this issue Dec 12, 2024 · 0 comments

Comments

@slowriot
Copy link
Contributor

slowriot commented Dec 12, 2024

For actions such as emscripten_set_click_callback, it would be really useful to support the once property in some way: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#once (similar to how the capture property is exposed via the useCapture parameter).

One use case would be in the Audio Worklets example laid out at https://emscripten.org/docs/api_reference/wasm_audio_worklets.html - here the click callback is needed for the first click ever only, to unpause the audio, and should ideally be unset after that.

In many cases this could also serve as an alternative to #20983 ("Add a way to remove a single event listener").

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