Should this be an RFC?
Which package is this a feature request for?
Observers (@lit-labs/observers)
Description
You can currently ResizeController.observe(...) new elements across the lifecycle of the controller, but you aren't given API to unobserve those elements. This method should likely be made private so that it is less likely to lead someone to leverage it and some sort of setter for the target (hopefully one that is easier to use than at current and accepts an array of elements) should be surfaced to ensure that more content can be easily managed by the observer.
This seems like a common patterns in the observer controllers, so each might benefit the same API structure.
Happy to mark up a PR for this if it's acceptable.
Alternatives and Workarounds
WORKAROUND:
You can force the type today with:
(this.resizeController as unknown as {
_observer: ResizeObserver
})._observer.unobserve(item);
ALTERANATIVE 1:
Or the observe method could be made private to clarify that this isn't functionality that should be taken advantage of outside of the host and target arguments in the constructor.
Should this be an RFC?
Which package is this a feature request for?
Observers (@lit-labs/observers)
Description
You can currently
ResizeController.observe(...)new elements across the lifecycle of the controller, but you aren't given API to unobserve those elements. This method should likely be made private so that it is less likely to lead someone to leverage it and some sort of setter for thetarget(hopefully one that is easier to use than at current and accepts an array of elements) should be surfaced to ensure that more content can be easily managed by the observer.This seems like a common patterns in the observer controllers, so each might benefit the same API structure.
Happy to mark up a PR for this if it's acceptable.
Alternatives and Workarounds
WORKAROUND:
You can force the type today with:
ALTERANATIVE 1:
Or the
observemethod could be madeprivateto clarify that this isn't functionality that should be taken advantage of outside of thehostandtargetarguments in the constructor.