Skip to main content
Version: 0.9.0-beta.2

Class: MenuBarService

molecule.MenuBarService

Hierarchy

Implements

Constructors

constructor

new MenuBarService()

Overrides

Component.constructor

Defined in

src/services/workbench/menuBarService.ts:59

Properties

sperator

Private sperator: string = '-'

Defined in

src/services/workbench/menuBarService.ts:57


state

Protected state: IMenuBar

Implementation of

IMenuBarService.state

Overrides

Component.state

Defined in

src/services/workbench/menuBarService.ts:56

Methods

append

append(menuItem, parentId): void

Append a new menu into the specific menu found by parentId

Parameters

NameType
menuItemIMenuBarItem
parentIdUniqueId

Returns

void

Implementation of

IMenuBarService.append

Defined in

src/services/workbench/menuBarService.ts:105


count

count(name): number

Count the service event

Parameters

NameTypeDescription
namestringEvent name

Returns

number

Implementation of

IMenuBarService.count

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

Implementation of

IMenuBarService.emit

Inherited from

Component.emit

Defined in

src/common/event/eventBus.ts:20


forceUpdate

forceUpdate(): void

Force to update the Component

Returns

void

Implementation of

IMenuBarService.forceUpdate

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

Implementation of

IMenuBarService.getMenuById

Defined in

src/services/workbench/menuBarService.ts:94


getReferenceMenu

Private getReferenceMenu(menuId): undefined | { path: string ; source: IMenuBarItem }

Get the specific menu reference type via menuId

Parameters

NameType
menuIdUniqueId

Returns

undefined | { path: string ; source: IMenuBarItem }

source is the target menu and path is the collections of indexs that contain the specific menu position

Defined in

src/services/workbench/menuBarService.ts:69


getState

getState(): IMenuBar

Get the Component state

Returns

IMenuBar

Implementation of

IMenuBarService.getState

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

Implementation of

IMenuBarService.onSelect

Defined in

src/services/workbench/menuBarService.ts:167


onUpdateState

onUpdateState(callback): void

Listen to the Component state update event

Parameters

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

Returns

void

Implementation of

IMenuBarService.onUpdateState

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

Implementation of

IMenuBarService.remove

Defined in

src/services/workbench/menuBarService.ts:122


removeOnUpdateState

removeOnUpdateState(): void

Remove the Component update event listening

Returns

void

Implementation of

IMenuBarService.removeOnUpdateState

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

Implementation of

IMenuBarService.render

Inherited from

Component.render

Defined in

src/react/component.ts:67


reset

reset(): void

Reset menu bar data;

Returns

void

Implementation of

IMenuBarService.reset

Defined in

src/services/workbench/menuBarService.ts:161


setMenus

setMenus(menuData): void

Set the menus data

Parameters

NameType
menuDataIMenuBarItem[]

Returns

void

Implementation of

IMenuBarService.setMenus

Defined in

src/services/workbench/menuBarService.ts:99


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

Implementation of

IMenuBarService.setState

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

Implementation of

IMenuBarService.subscribe

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

Implementation of

IMenuBarService.unsubscribe

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

Implementation of

IMenuBarService.update

Defined in

src/services/workbench/menuBarService.ts:148