We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
removeEventListener
import std/[dom] proc onkeydownEventHandler(e: Event) = echo "hey" window.addEventListener "keydown", onkeydownEventHandler window.removeEventListener "keydown", onkeydownEventHandler
<script src="./play.js"></script>
Nim Compiler Version 2.1.9 [Windows: amd64] Compiled at 2024-07-30 Copyright (c) 2006-2024 by Andreas Rumpf
active boot switches: -d:release
`hey` is printed after every key press
it should not not log anything when pressing keys
here's the produced code when -d:danger:
-d:danger
Temporary1 = onkeydownEventHandler__play_u2.bind(null); Temporary1.ClP_0 = onkeydownEventHandler__play_u2; Temporary1.ClE_0 = null; window.addEventListener("keydown", Temporary1, false); Temporary2 = onkeydownEventHandler__play_u2.bind(null); Temporary2.ClP_0 = onkeydownEventHandler__play_u2; Temporary2.ClE_0 = null; window.removeEventListener("keydown", Temporary2);
it would work simply if the following code would be generated:
window.addEventListener("keydown", onkeydownEventHandler__play_u2, false); window.removeEventListener("keydown", onkeydownEventHandler__play_u2);
perhaps it is good to allow addr someFunction in js backend for workaround. i.e. the following code should produce the above code:
addr someFunction
js
window.addEventListener "keydown", addr onkeydownEventHandler window.removeEventListener "keydown", addr onkeydownEventHandler
No response
The text was updated successfully, but these errors were encountered:
workaround
import std/[dom] proc onkeydownEventHandler(e: Event) = echo "hey" let e1: proc (event: Event) {.closure.} = onkeydownEventHandler window.addEventListener "keydown", e1 window.removeEventListener "keydown", e1
Sorry, something went wrong.
No branches or pull requests
Description
Nim Version
Nim Compiler Version 2.1.9 [Windows: amd64]
Compiled at 2024-07-30
Copyright (c) 2006-2024 by Andreas Rumpf
active boot switches: -d:release
Current Output
Expected Output
Possible Solution
here's the produced code when
-d:danger
:it would work simply if the following code would be generated:
perhaps it is good to allow
addr someFunction
injs
backend for workaround. i.e. the following code should produce the above code:Additional Information
No response
The text was updated successfully, but these errors were encountered: