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

Plugin API event off does not work properly #313

Open
airslice opened this issue Aug 1, 2022 · 0 comments
Open

Plugin API event off does not work properly #313

airslice opened this issue Aug 1, 2022 · 0 comments
Labels
bug Something isn't working frontend help wanted Extra attention is needed

Comments

@airslice
Copy link
Contributor

airslice commented Aug 1, 2022

Describe the bug

Calling reearth.off from plugin code cannot remove the event listener.

  • Calling from console works fine.

To Reproduce
Steps to reproduce the behavior:

  1. Create a plugin with call to reearth.on.
  2. Check the event fires.
  3. Edit plugin code add a call to reearth.off to remove the previous function.
  4. The event listener sitll working.

Expected behavior
The event listener should be removed.

Screenshots

Desktop (please complete the following information):

  • OS: [macOS]
  • Browser [chrome]
  • Version [103.0.5060.134]

Smartphone (please complete the following information):

  • N/A

Additional context

Some info related:

  • The event callbacks are managed in a map with the callback functions as their keys.
  • If got the same function it got the same key then can be removed normally.
  • When called from plugin context Arena (quickjs-emscripten-sync) somehow wrapped the function as a proxy.
  • The proxy now becomes the key and it seems always different (i guess) and make it impossible to remove.
@airslice airslice added bug Something isn't working frontend labels Aug 1, 2022
@airslice airslice added the help wanted Extra attention is needed label Aug 1, 2022
pyshx pushed a commit that referenced this issue Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant