Abstract
Initialize the part with internal fields
Protected
disconnectedUser 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.
Protected
reconnectedAbstract
renderSets 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
Directive
base class whosedisconnected
method 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'sreconnected
method will be called prior to its nextupdate
/render
callbacks. When implementingdisconnected
,reconnected
should 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.isConnected
flag during render/update to determine whether it is safe to subscribe to resources that may prevent garbage collection.