跳到主要内容
版本:Next

Class: NotificationService

molecule.NotificationService

Hierarchy​

Implements​

Constructors​

constructor​

• new NotificationService()

Overrides​

Component.constructor

Defined in​

services/notificationService.ts:52

Properties​

state​

• Protected state: INotification<any>

Implementation of​

INotificationService.state

Overrides​

Component.state

Defined in​

services/notificationService.ts:50

Methods​

add​

▸ add<T>(items): null | INotificationItem<T>[]

Add new notification items

Type parameters​

Name
T

Parameters​

NameType
itemsINotificationItem<T>[]

Returns​

null | INotificationItem<T>[]

Implementation of​

INotificationService.add

Defined in​

services/notificationService.ts:106


clear​

▸ clear(): void

Clear the notifications

Returns​

void

Implementation of​

INotificationService.clear

Defined in​

services/notificationService.ts:125


count​

▸ count(name): number

Count the service event

Parameters​

NameTypeDescription
namestringEvent name

Returns​

number

Implementation of​

INotificationService.count

Inherited from​

Component.count

Defined in​

common/event/eventBus.ts:28


emit​

▸ emit(name, ...args): void

Emit the service event

Parameters​

NameTypeDescription
namestringEvent name
...argsanyArguments

Returns​

void

Implementation of​

INotificationService.emit

Inherited from​

Component.emit

Defined in​

common/event/eventBus.ts:20


forceUpdate​

▸ forceUpdate(): void

Force to update the Component

Returns​

void

Implementation of​

INotificationService.forceUpdate

Inherited from​

Component.forceUpdate

Defined in​

react/component.ts:81


getState​

▸ getState(): INotification<any>

Get the Component state

Returns​

INotification<any>

Implementation of​

INotificationService.getState

Inherited from​

Component.getState

Defined in​

react/component.ts:85


onUpdateState​

▸ onUpdateState(listener): void

Listen to the Component state update event

Parameters​

NameType
listener(prevState: INotification<any>, nextState: INotification<any>) => void

Returns​

void

Implementation of​

INotificationService.onUpdateState

Inherited from​

Component.onUpdateState

Defined in​

react/component.ts:73


remove​

▸ remove(id): void

Remove the specific notification item by id

Parameters​

NameType
idUniqueId

Returns​

void

Implementation of​

INotificationService.remove

Defined in​

services/notificationService.ts:84


removeOnUpdateState​

▸ removeOnUpdateState(listener?): void

Remove the Component update event listening, default is remove all, also you can remove one by pass the listener

Parameters​

NameType
listener?Function

Returns​

void

Implementation of​

INotificationService.removeOnUpdateState

Inherited from​

Component.removeOnUpdateState

Defined in​

react/component.ts:77


render​

▸ render(nextState?): void

Initiative notify the component to render the view by the state

Parameters​

NameType
nextState?INotification<any>

Returns​

void

Implementation of​

INotificationService.render

Inherited from​

Component.render

Defined in​

react/component.ts:69


reset​

▸ reset(): void

Reset notifications, this will clear the pending notifications

Returns​

void

Implementation of​

INotificationService.reset

Defined in​

services/notificationService.ts:131


setState​

▸ setState(values, callback?): void

Set the state values, and notify the view component to re render

Parameters​

NameTypeDescription
valuesPartial<INotification<any>>update target state values
callback?(prevState: INotification<any>, nextState: INotification<any>) => void-

Returns​

void

Implementation of​

INotificationService.setState

Inherited from​

Component.setState

Defined in​

react/component.ts:56


subscribe​

▸ subscribe(name, listener): void

Subscribe the service event

Parameters​

NameTypeDescription
namestring | string[]Event name
listenerFunctionListener function

Returns​

void

Implementation of​

INotificationService.subscribe

Inherited from​

Component.subscribe

Defined in​

common/event/eventBus.ts:11


toggleNotification​

▸ toggleNotification(): void

Toggle the Notification view between display or hidden

Returns​

void

Implementation of​

INotificationService.toggleNotification

Defined in​

services/notificationService.ts:57


unsubscribe​

▸ unsubscribe(name, listener?): void

Unsubscribe the specific event and the listener function

Parameters​

NameTypeDescription
nameanyThe event name
listener?Functionoptional, it unsubscribes events via name if not pass the listener function

Returns​

void

Implementation of​

INotificationService.unsubscribe

Inherited from​

Component.unsubscribe

Defined in​

common/event/eventBus.ts:37


update​

▸ update<T>(item): null | INotificationItem<T>

Update the specific notification item

Type parameters​

Name
T

Parameters​

NameType
itemINotificationItem<T>

Returns​

null | INotificationItem<T>

Implementation of​

INotificationService.update

Defined in​

services/notificationService.ts:63