This requires that listeners added in connectedCallback are removed in disconnectedCallback.
Some shortcomings where we should improve in future:
It will only detect those attached directly to this for now
It will not yet determine that the correct reference was passed to both cases (i.e. addEventListener('x', foo) is considered cleaned up if we see removeEventListener('x', bar))
It will check all classes without considering base class (should be ok since nobody else uses a connectedCallback usually)
This requires that listeners added in
connectedCallback
are removed indisconnectedCallback
.Some shortcomings where we should improve in future:
this
for nowaddEventListener('x', foo)
is considered cleaned up if we seeremoveEventListener('x', bar)
)