Interface: INotificationService
molecule.INotificationService
Hierarchy
↳
INotificationService
Implemented by
Properties
state
• Protected
Abstract
state: INotification
<any
>
Inherited from
Defined in
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
>[]
Defined in
services/notificationService.ts:20
clear
▸ clear(): void
Clear the notifications
Returns
void
Defined in
services/notificationService.ts:38
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
Inherited from
Defined in
getState
▸ getState(): INotification
<any
>
Get the Component state
Returns
INotification
<any
>
Inherited from
Defined in
onUpdateState
▸ onUpdateState(listener
): void
Listen to the Component state update event
Parameters
Name | Type |
---|---|
listener | (prevState : INotification <any >, nextState : INotification <any >) => void |
Returns
void
Inherited from
Defined in
remove
▸ remove(id
): void
Remove the specific notification item by id
Parameters
Name | Type |
---|---|
id | UniqueId |
Returns
void
Defined in
services/notificationService.ts:25
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
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
Inherited from
Defined in
reset
▸ reset(): void
Reset notifications, this will clear the pending notifications
Returns
void
Defined in
services/notificationService.ts:42
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
Inherited from
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
toggleNotification
▸ toggleNotification(): void
Toggle the Notification view between display or hidden
Returns
void
Defined in
services/notificationService.ts:34
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
Inherited from
Defined in
update
▸ update<T
>(item
): null
| INotificationItem
<T
>
Update the specific notification item
Type parameters
Name |
---|
T |
Parameters
Name | Type | Description |
---|---|---|
item | INotificationItem <T > | notification item, the id field is required |
Returns
null
| INotificationItem
<T
>