-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
lib: add weak event handlers #36607
lib: add weak event handlers #36607
Conversation
The motivation for this is:
|
f3d27aa
to
cc5c8bb
Compare
I need to think about this more. |
Re-applied the changes with weak event handlers based on the comment (using an object as the retainer key) |
cc5c8bb
to
512ea05
Compare
Do you plan to add documentation for this feature? |
Not really since this feature is internal to core - users cannot create weak listeners. This is because that is a spec requirement (we cannot add things to the standard EventTarget). In the future - I'd like to use the mechanics of this in several utilities (and internally) namely:
|
512ea05
to
1814443
Compare
PR-URL: #36607 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
Landed in 5ef4c64 🎉 |
PR-URL: #36607 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
This is a first attempt at "weak listeners".
Still a draft since I have no idea how to test this :] Do we have any idea how to test WeakRefs?EDIT: added a test.Also still playing with this - but I think this is generally very useful and I will move certain APIs to it.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes