跳到主要内容
版本:0.9.0-beta.2

Interface: IMenuBarService

molecule.IMenuBarService

Hierarchy

Implemented by

Properties

state

Protected Abstract state: IMenuBar

Inherited from

Component.state

Defined in

src/react/component.ts:42

Methods

append

append(menuItem, parentId): void

Append a new menu into the specific menu found by parentId

Parameters

NameTypeDescription
menuItemIMenuBarItemthe new menu
parentIdUniqueId

Returns

void

Defined in

src/services/workbench/menuBarService.ts:25


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


getMenuById

getMenuById(menuId): undefined | IMenuBarItem

Get the specific menu item

Parameters

NameType
menuIdUniqueId

Returns

undefined | IMenuBarItem

Defined in

src/services/workbench/menuBarService.ts:35


getState

getState(): IMenuBar

Get the Component state

Returns

IMenuBar

Inherited from

Component.getState

Defined in

src/react/component.ts:83


onSelect

onSelect(callback): void

listen to the onSelect event in menu

Parameters

NameType
callback(menuId: UniqueId) => void

Returns

void

Defined in

src/services/workbench/menuBarService.ts:50


onUpdateState

onUpdateState(callback): void

Listen to the Component state update event

Parameters

NameType
callback(prevState: IMenuBar, nextState: IMenuBar) => void

Returns

void

Inherited from

Component.onUpdateState

Defined in

src/react/component.ts:71


remove

remove(menuId): void

Remove the specific menu item

Parameters

NameType
menuIdUniqueId

Returns

void

Defined in

src/services/workbench/menuBarService.ts:30


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?IMenuBar

Returns

void

Inherited from

Component.render

Defined in

src/react/component.ts:67


reset

reset(): void

Reset menu bar data;

Returns

void

Defined in

src/services/workbench/menuBarService.ts:45


setMenus

setMenus(data): void

Set the menus data

Parameters

NameType
dataIMenuBarItem[]

Returns

void

Defined in

src/services/workbench/menuBarService.ts:19


setState

setState(values, callback?): void

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

Parameters

NameTypeDescription
valuesPartial<IMenuBar>update target state values
callback?(prevState: IMenuBar, nextState: IMenuBar) => 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


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(menuId, menuItem): void

Update the specific menu item data

Parameters

NameType
menuIdUniqueId
menuItemIMenuBarItem

Returns

void

Defined in

src/services/workbench/menuBarService.ts:41