Skip to content

Conversation

keithamus
Copy link
Contributor

@keithamus keithamus commented Oct 31, 2020

What?

This change adds listenForBind(element.ownerDocument) to any element that calls bind(element). Calls to listenForBind are then memoized by node, so we don't oversubscribe to documents. This effectively means each document an element is added to will be registered (typically this is 1).

listenForBind is still left as an exported member, as are all of our functions, and the documentation has been clarified on how it can be used for some extremely rare cases, should it need to be. The doc also importantly describes how it is automatically called on ownerDocument.

This is a non-breaking change, in the sense that if we ship this we need to make no additional code changes; as any current calls of listenForBind(document) will be memoized away.

Why?

We've had listenForBind(document) running in production for a while now with no performance issues that we know of. I'd consider this stable enough to "ship" by default.

@keithamus keithamus requested a review from a team as a code owner October 31, 2020 00:52
Copy link
Contributor

@koddsson koddsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! ✨

@keithamus keithamus merged commit 126670b into main Nov 2, 2020
@keithamus keithamus deleted the auto-call-listenforbind branch November 2, 2020 17:05
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.

2 participants