Skip to main content
Version: Next

Class: MenuBarService

molecule.MenuBarService

Hierarchy

Implements

Constructors

constructor

new MenuBarService()

Overrides

Component.constructor

Defined in

services/workbench/menuBarService.ts:60

Properties

sperator

Private sperator: string = '-'

Defined in

services/workbench/menuBarService.ts:58


state

Protected state: IMenuBar

Implementation of

IMenuBarService.state

Overrides

Component.state

Defined in

services/workbench/menuBarService.ts:57

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

services/workbench/menuBarService.ts:106


count

count(name): number

Count the service event

Parameters

NameTypeDescription
namestringEvent name

Returns

number

Implementation of

IMenuBarService.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

IMenuBarService.emit

Inherited from

Component.emit

Defined in

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

react/component.ts:81


getMenuById

getMenuById(menuId): undefined | IMenuBarItem

Get the specific menu item

Parameters

NameType
menuIdUniqueId

Returns

undefined | IMenuBarItem

Implementation of

IMenuBarService.getMenuById

Defined in

services/workbench/menuBarService.ts:95


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

services/workbench/menuBarService.ts:70


getState

getState(): IMenuBar

Get the Component state

Returns

IMenuBar

Implementation of

IMenuBarService.getState

Inherited from

Component.getState

Defined in

react/component.ts:85


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

services/workbench/menuBarService.ts:168


onUpdateState

onUpdateState(listener): void

Listen to the Component state update event

Parameters

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

Returns

void

Implementation of

IMenuBarService.onUpdateState

Inherited from

Component.onUpdateState

Defined in

react/component.ts:73


remove

remove(menuId): void

Remove the specific menu item

Parameters

NameType
menuIdUniqueId

Returns

void

Implementation of

IMenuBarService.remove

Defined in

services/workbench/menuBarService.ts:123


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

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

Returns

void

Implementation of

IMenuBarService.render

Inherited from

Component.render

Defined in

react/component.ts:69


reset

reset(): void

Reset menu bar data;

Returns

void

Implementation of

IMenuBarService.reset

Defined in

services/workbench/menuBarService.ts:162


setMenus

setMenus(menuData): void

Set the menus data

Parameters

NameType
menuDataIMenuBarItem[]

Returns

void

Implementation of

IMenuBarService.setMenus

Defined in

services/workbench/menuBarService.ts:100


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

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

IMenuBarService.subscribe

Inherited from

Component.subscribe

Defined in

common/event/eventBus.ts:11


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

IMenuBarService.unsubscribe

Inherited from

Component.unsubscribe

Defined in

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

services/workbench/menuBarService.ts:149