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
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
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(listener): void
Listen to the Component state update event
Parameters
| Name | Type |
|---|---|
listener | (prevState: S, nextState: S) => void |
Returns
void
Implementation of
Defined in
removeOnUpdateState
▸ removeOnUpdateState(listener?): void
Remove the Component update event listening, default is remove all, also you can remove one by pass the listener
Parameters
| Name | Type |
|---|---|
listener? | Function |
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, listener): void
Subscribe the service event
Parameters
| Name | Type | Description |
|---|---|---|
name | string | string[] | Event name |
listener | Function | Listener function |
Returns
void
Inherited from
Defined in
unsubscribe
▸ unsubscribe(name, listener?): void
Unsubscribe the specific event and the listener function
Parameters
| Name | Type | Description |
|---|---|---|
name | any | The event name |
listener? | Function | optional, it unsubscribes events via name if not pass the listener function |
Returns
void