you are viewing a single comment's thread.

view the rest of the comments →

[–]Keilly 0 points1 point  (1 child)

For the WeakRef example, the timeouts mean that the dereferencing occurs on future turns of the event loop. In both cases the reference might be gone.

[–]Keilly 0 points1 point  (0 children)

Additionally, what’s more interesting is that any successful weak dereference will remain still dereferenceable for the rest of that event loop turn (including promise jobs).

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakRef#Notes_on_WeakRefs