Abstract Class: LifecycleComponent<P, Contexts>
Defined in: src/sdk/components/common/LifecycleComponent.ts:16
An implementation of DisplayComponent which creates its own Lifecycle implementation that can be tied to subscriptions created within the component.
This component provides pause()
and resume()
methods, which act upon the attached lifecycle and the first LifecycleComponent
in each branch of its children component tree.
This component also, by default, destroys the first DisplayComponent
in each branch of its children component tree
when it is itself destroyed.
Extends
DisplayComponent
<P
,Contexts
>
Type Parameters
Type Parameter | Default type |
---|---|
P | - |
Contexts extends unknown [] | [] |
Constructors
Constructor
new LifecycleComponent<
P
,Contexts
>(props
):LifecycleComponent
<P
,Contexts
>
Defined in: src/sdk/components/FSComponent.ts:73
Creates an instance of a DisplayComponent.
Parameters
Parameter | Type | Description |
---|---|---|
props | P | The propertis of the component. |
Returns
LifecycleComponent
<P
, Contexts
>
Inherited from
Properties
context?
optional
context: [...ContextSubcriptions<Contexts>[]
] =undefined
Defined in: src/sdk/components/FSComponent.ts:64
The context on this component, if any.
Inherited from
contextType?
readonly
optional
contextType: readonly [ContextTypes
<Contexts
>] =undefined
Defined in: src/sdk/components/FSComponent.ts:67
The type of context for this component, if any.
Inherited from
defaultLifecycle
protected
readonly
defaultLifecycle:Lifecycle
Defined in: src/sdk/components/common/LifecycleComponent.ts:18
The default lifecycle to use to managed subscriptions.
props
props:
P
&ComponentProps
Defined in: src/sdk/components/FSComponent.ts:61
The properties of the component.
Inherited from
thisNode?
protected
optional
thisNode:VNode
Defined in: src/sdk/components/common/LifecycleComponent.ts:20
Methods
createDefaultLifecycle()
protected
createDefaultLifecycle():Lifecycle
Defined in: src/sdk/components/common/LifecycleComponent.ts:26
Creates the component's default lifecycle.
Returns
A lifecycle to use as the default.
destroy()
destroy():
void
Defined in: src/sdk/components/common/LifecycleComponent.ts:43
Destroys this component.
Returns
void
Overrides
forChildNodes()
protected
forChildNodes(fn
):void
Defined in: src/sdk/components/common/LifecycleComponent.ts:70
Iterates over immediate child nodes.
Parameters
Parameter | Type | Description |
---|---|---|
fn | (n ) => void | The function to call when a LifecycleComponent is found. |
Returns
void
getContext()
protected
getContext(context
):ContextSubcriptions
<Contexts
>[number
]
Defined in: src/sdk/components/FSComponent.ts:106
Gets a context data subscription from the context collection.
Parameters
Parameter | Type | Description |
---|---|---|
context | ContextTypes <Contexts >[number ] | The context to get the subscription for. |
Returns
ContextSubcriptions
<Contexts
>[number
]
The requested context.
Throws
An error if no data for the specified context type could be found.
Inherited from
onAfterRender()
onAfterRender(
node
):void
Defined in: src/sdk/components/common/LifecycleComponent.ts:52
A callback that is called after the component is rendered.
Parameters
Parameter | Type | Description |
---|---|---|
node | VNode | The component's VNode. |
Returns
void
Overrides
DisplayComponent
.onAfterRender
onBeforeRender()
onBeforeRender():
void
Defined in: src/sdk/components/FSComponent.ts:80
A callback that is called before the component is rendered.
Returns
void
Inherited from
DisplayComponent
.onBeforeRender
pause()
pause():
void
Defined in: src/sdk/components/common/LifecycleComponent.ts:31
Pauses subscriptions managed by the component lifecycle and the first LifecycleComponent
of each child component branch.
Returns
void
register()
protected
register<T
>(sub
):T
Defined in: src/sdk/components/common/LifecycleComponent.ts:62
Registers a subscription with the component default lifecycle.
Type Parameters
Type Parameter |
---|
T extends Subscription |
Parameters
Parameter | Type | Description |
---|---|---|
sub | T | The subscription to register. |
Returns
T
The registered subscription.
render()
abstract
render():null
|VNode
Defined in: src/sdk/components/FSComponent.ts:93
Renders the component.
Returns
null
| VNode
A JSX element to be rendered.
Inherited from
resume()
resume():
void
Defined in: src/sdk/components/common/LifecycleComponent.ts:37
Resumes subscriptions managed by the component lifecycle and the first LifecycleComponent of each child component branch.
Returns
void