Class: NotificationService
molecule.NotificationService
Hierarchy
↳
NotificationService
Implements
Constructors
constructor
• new NotificationService()
Overrides
Defined in
src/services/notificationService.ts:51
Properties
state
• Protected
state: INotification
<any
>
Implementation of
Overrides
Defined in
src/services/notificationService.ts:49
Methods
add
▸ add<T
>(items
): null
| INotificationItem
<T
>[]
Add new notification items
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
items | INotificationItem <T >[] |
Returns
null
| INotificationItem
<T
>[]
Implementation of
Defined in
src/services/notificationService.ts:105
clear
▸ clear(): void
Clear the notifications
Returns
void
Implementation of
Defined in
src/services/notificationService.ts:124
count
▸ count(name
): number
Count the service event
Parameters
Name | Type | Description |
---|---|---|
name | string | Event name |
Returns
number
Implementation of
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
Implementation of
Inherited from
Defined in
src/common/event/eventBus.ts:20
forceUpdate
▸ forceUpdate(): void
Force to update the Component
Returns
void
Implementation of
INotificationService.forceUpdate
Inherited from
Defined in
getState
▸ getState(): INotification
<any
>
Get the Component state
Returns
INotification
<any
>
Implementation of
Inherited from
Defined in
onUpdateState
▸ onUpdateState(callback
): void
Listen to the Component state update event
Parameters
Name | Type |
---|---|
callback | (prevState : INotification <any >, nextState : INotification <any >) => void |
Returns
void
Implementation of
INotificationService.onUpdateState
Inherited from
Defined in
remove
▸ remove(id
): void
Remove the specific notification item by id
Parameters
Name | Type |
---|---|
id | UniqueId |
Returns
void
Implementation of
Defined in
src/services/notificationService.ts:83
removeOnUpdateState
▸ removeOnUpdateState(): void
Remove the Component update event listening
Returns
void
Implementation of
INotificationService.removeOnUpdateState
Inherited from
Defined in
render
▸ render(nextState?
): void
Initiative notify the component to render the view by the state
Parameters
Name | Type |
---|---|
nextState? | INotification <any > |
Returns
void
Implementation of
Inherited from
Defined in
reset
▸ reset(): void
Reset notifications, this will clear the pending notifications
Returns
void
Implementation of
Defined in
src/services/notificationService.ts:130
setState
▸ setState(values
, callback?
): void
Set the state values, and notify the view component to re render
Parameters
Name | Type | Description |
---|---|---|
values | Partial <INotification <any >> | update target state values |
callback? | (prevState : INotification <any >, nextState : INotification <any >) => void | - |
Returns
void
Implementation of
Inherited from
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
Implementation of
INotificationService.subscribe
Inherited from
Defined in
src/common/event/eventBus.ts:11
toggleNotification
▸ toggleNotification(): void
Toggle the Notification view between display or hidden
Returns
void
Implementation of
INotificationService.toggleNotification
Defined in
src/services/notificationService.ts:56
unsubscribe
▸ unsubscribe(name
): void
Unsubscribe the specific event
Parameters
Name | Type | Description |
---|---|---|
name | any | The event name |
Returns
void
Implementation of
INotificationService.unsubscribe
Inherited from
Defined in
src/common/event/eventBus.ts:37
update
▸ update<T
>(item
): null
| INotificationItem
<T
>
Update the specific notification item
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
item | INotificationItem <T > |
Returns
null
| INotificationItem
<T
>