-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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 <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
Landed in 5ef4c64 🎉 |
PR-URL: #36607 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
Fixes: #37220 Refs: #36607 PR-URL: #46494 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
Fixes: #37220 Refs: #36607 PR-URL: #46494 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
Fixes: #37220 Refs: #36607 PR-URL: #46494 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
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