AbstractInitialize the part with internal fields
ProtecteddisconnectedUser callbacks for implementing logic to release any resources/subscriptions
that may have been retained by this directive. Since directives may also be
re-connected, reconnected should also be implemented to restore the
working state of the directive prior to the next render.
ProtectedreconnectedAbstractrenderSets the value of the directive's Part outside the normal update/render
lifecycle of a directive.
This method should not be called synchronously from a directive's update
or render.
The value to set
An abstract
Directivebase class whosedisconnectedmethod will be called when the part containing the directive is cleared as a result of re-rendering, or when the user callspart.setConnected(false)on a part that was previously rendered containing the directive (as happens when e.g. a LitElement disconnects from the DOM).If
part.setConnected(true)is subsequently called on a containing part, the directive'sreconnectedmethod will be called prior to its nextupdate/rendercallbacks. When implementingdisconnected,reconnectedshould also be implemented to be compatible with reconnection.Note that updates may occur while the directive is disconnected. As such, directives should generally check the
this.isConnectedflag during render/update to determine whether it is safe to subscribe to resources that may prevent garbage collection.