Skip to main content
Version: 0.9.0-beta.2

Interface: INotificationService

molecule.INotificationService

Hierarchy

Implemented by

Properties

state

Protected Abstract state: INotification<any>

Inherited from

Component.state

Defined in

src/react/component.ts:42

Methods

add

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

Add new notification items

Type parameters

Name
T

Parameters

NameType
itemsINotificationItem<T>[]

Returns

null | INotificationItem<T>[]

Defined in

src/services/notificationService.ts:20


clear

clear(): void

Clear the notifications

Returns

void

Defined in

src/services/notificationService.ts:38


count

count(name): number

Count the service event

Parameters

NameTypeDescription
namestringEvent name

Returns

number

Inherited from

Component.count

Defined in

src/common/event/eventBus.ts:28


emit

emit(name, ...args): void

Emit the service event

Parameters

NameTypeDescription
namestringEvent name
...argsanyArguments

Returns

void

Inherited from

Component.emit

Defined in

src/common/event/eventBus.ts:20


forceUpdate

forceUpdate(): void

Force to update the Component

Returns

void

Inherited from

Component.forceUpdate

Defined in

src/react/component.ts:79


getState

getState(): INotification<any>

Get the Component state

Returns

INotification<any>

Inherited from

Component.getState

Defined in

src/react/component.ts:83


onUpdateState

onUpdateState(callback): void

Listen to the Component state update event

Parameters

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

Returns

void

Inherited from

Component.onUpdateState

Defined in

src/react/component.ts:71


remove

remove(id): void

Remove the specific notification item by id

Parameters

NameType
idUniqueId

Returns

void

Defined in

src/services/notificationService.ts:25


removeOnUpdateState

removeOnUpdateState(): void

Remove the Component update event listening

Returns

void

Inherited from

Component.removeOnUpdateState

Defined in

src/react/component.ts:75


render

render(nextState?): void

Initiative notify the component to render the view by the state

Parameters

NameType
nextState?INotification<any>

Returns

void

Inherited from

Component.render

Defined in

src/react/component.ts:67


reset

reset(): void

Reset notifications, this will clear the pending notifications

Returns

void

Defined in

src/services/notificationService.ts:42


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

Inherited from

Component.setState

Defined in

src/react/component.ts:54


subscribe

subscribe(name, callback): void

Subscribe the service event

Parameters

NameTypeDescription
namestring | string[]Event name
callbackFunctionCallback function

Returns

void

Inherited from

Component.subscribe

Defined in

src/common/event/eventBus.ts:11


toggleNotification

toggleNotification(): void

Toggle the Notification view between display or hidden

Returns

void

Defined in

src/services/notificationService.ts:34


unsubscribe

unsubscribe(name): void

Unsubscribe the specific event

Parameters

NameTypeDescription
nameanyThe event name

Returns

void

Inherited from

Component.unsubscribe

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

NameTypeDescription
itemINotificationItem<T>notification item, the id field is required

Returns

null | INotificationItem<T>

Defined in

src/services/notificationService.ts:30