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 - context onstatechange event and listeners #52

Closed
wants to merge 3 commits into from

Conversation

b-ma
Copy link
Collaborator

@b-ma b-ma commented Dec 10, 2023

First working version

Todos

  • create proper Event instance (missing target, etc)
  • clear listener when the rust instance is dropped? (is it dropped actually?)

@orottier
Copy link
Collaborator

I was wondering if it may not be easier and more general to perform actual event dispatching, like so:

  • when an audiobuffersourcenode is created
  • always register an on_ended on the rust side
  • in on_ended, call dispatchEvent on the Js object
  • monkey patch the setter of onended to an addEventListener call

In any case, the current implementation also looks good to me

@b-ma
Copy link
Collaborator Author

b-ma commented Dec 10, 2023

Hum, that's more or less what is done, but maybe your solution would be more elegant yes, I will have a try

In any case, the current implementation is not clean as it prevents the event target to be garbage collected...

I will also have another look on that article https://www.nearform.com/blog/node-js-and-the-struggles-of-being-an-eventtarget/ which might also help having something more clean

@b-ma b-ma mentioned this pull request Dec 29, 2023
6 tasks
@b-ma b-ma closed this Dec 31, 2023
@b-ma b-ma deleted the feat/context-onstatechange branch January 2, 2024 15:46
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

Successfully merging this pull request may close these issues.

None yet

2 participants