Class: Component<S>
Type parameters
Name | Type |
---|---|
S | any |
Hierarchy
↳
Component
↳↳
PanelService
Implements
IComponent
<S
>
Constructors
constructor
• new Component<S
>()
Type parameters
Name | Type |
---|---|
S | any |
Overrides
Defined in
Properties
_event
• Private
_event: EventEmitter
Defined in
state
• Protected
Abstract
state: S
Defined in
Methods
count
▸ count(name
): number
Count the service event
Parameters
Name | Type | Description |
---|---|---|
name | string | Event name |
Returns
number
Inherited from
Defined in
src/common/event/eventBus.ts:28
emit
▸ emit(name
, ...args
): void
Emit the service event
Parameters
Name | Type | Description |
---|---|---|
name | string | Event name |
...args | any | Arguments |
Returns
void
Inherited from
Defined in
src/common/event/eventBus.ts:20
forceUpdate
▸ forceUpdate(): void
Force to update the Component
Returns
void
Implementation of
Defined in
getState
▸ getState(): S
Get the Component state
Returns
S
Implementation of
Defined in
onUpdateState
▸ onUpdateState(callback
): void
Listen to the Component state update event
Parameters
Name | Type |
---|---|
callback | (prevState : S , nextState : S ) => void |
Returns
void
Implementation of
Defined in
removeOnUpdateState
▸ removeOnUpdateState(): void
Remove the Component update event listening
Returns
void
Implementation of
IComponent.removeOnUpdateState
Defined in
render
▸ render(nextState?
): void
Initiative notify the component to render the view by the state
Parameters
Name | Type |
---|---|
nextState? | S |
Returns
void
Implementation of
Defined in
setState
▸ setState(values
, callback?
): void
Set the state values, and notify the view component to re render
Parameters
Name | Type | Description |
---|---|---|
values | Partial <S > | update target state values |
callback? | (prevState : S , nextState : S ) => void | - |
Returns
void
Implementation of
Defined in
subscribe
▸ subscribe(name
, callback
): void
Subscribe the service event
Parameters
Name | Type | Description |
---|---|---|
name | string | string [] | Event name |
callback | Function | Callback function |
Returns
void
Inherited from
Defined in
src/common/event/eventBus.ts:11
unsubscribe
▸ unsubscribe(name
): void
Unsubscribe the specific event
Parameters
Name | Type | Description |
---|---|---|
name | any | The event name |
Returns
void