Skip to content

ComponentEx.isUnloaded method

ComponentEx › isUnloaded

Returns whether the component has already been unloaded, as opposed to simply not having been loaded yet.

Both states leave _loaded false, but they mean opposite things: a component that was never loaded is still ahead of its lifecycle (queueing children before load is legitimate), while an unloaded one is behind it and must not be used any further. The distinction is tracked by a flag set in load, NOT by an Component.onunload override, because subclasses override onunload and may not call super.

Use it in a long-running async method to abandon work whose component was unloaded mid-flight, when unwinding via the SilentError thrown by ensureLoaded / addChild is not desired.

Signature:

isUnloaded(): boolean

Returns: booleantrue if the component was loaded at some point and is currently unloaded, otherwise false.