Class: MenuBarService
molecule.MenuBarService
Hierarchy
Implements
Constructors
constructor
• new MenuBarService()
Overrides
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
Overrides
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
| Name | Type |
|---|---|
menuItem | IMenuBarItem |
parentId | UniqueId |
Returns
void
Implementation of
Defined in
src/services/workbench/menuBarService.ts:105
count
▸ count(name): number
Count the service event
Parameters
| Name | Type | Description |
|---|---|---|
name | string | Event name |
Returns
number
Implementation of
Inherited from
Defined in
src/common/event/eventBus.ts:28
emit
▸ emit(name, ...args): void
Emit the service event
Parameters
| Name | Type | Description |
|---|---|---|
name | string | Event name |
...args | any | Arguments |
Returns
void
Implementation of
Inherited from
Defined in
src/common/event/eventBus.ts:20
forceUpdate
▸ forceUpdate(): void
Force to update the Component
Returns
void
Implementation of
Inherited from
Defined in
getMenuById
▸ getMenuById(menuId): undefined | IMenuBarItem
Get the specific menu item
Parameters
| Name | Type |
|---|---|
menuId | UniqueId |
Returns
undefined | IMenuBarItem
Implementation of
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
| Name | Type |
|---|---|
menuId | UniqueId |
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
Implementation of
Inherited from
Defined in
onSelect
▸ onSelect(callback): void
listen to the onSelect event in menu
Parameters
| Name | Type |
|---|---|
callback | (menuId: UniqueId) => void |
Returns
void
Implementation of
Defined in
src/services/workbench/menuBarService.ts:167
onUpdateState
▸ onUpdateState(callback): void
Listen to the Component state update event
Parameters
| Name | Type |
|---|---|
callback | (prevState: IMenuBar, nextState: IMenuBar) => void |
Returns
void
Implementation of
Inherited from
Defined in
remove
▸ remove(menuId): void
Remove the specific menu item
Parameters
| Name | Type |
|---|---|
menuId | UniqueId |
Returns
void
Implementation of
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
Defined in
render
▸ render(nextState?): void
Initiative notify the component to render the view by the state
Parameters
| Name | Type |
|---|---|
nextState? | IMenuBar |
Returns
void
Implementation of
Inherited from
Defined in
reset
▸ reset(): void
Reset menu bar data;
Returns
void
Implementation of
Defined in
src/services/workbench/menuBarService.ts:161
setMenus
▸ setMenus(menuData): void
Set the menus data
Parameters
| Name | Type |
|---|---|
menuData | IMenuBarItem[] |
Returns
void
Implementation of
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
| Name | Type | Description |
|---|---|---|
values | Partial<IMenuBar> | update target state values |
callback? | (prevState: IMenuBar, nextState: IMenuBar) => void | - |
Returns
void
Implementation of
Inherited from
Defined in
subscribe
▸ subscribe(name, callback): void
Subscribe the service event
Parameters
| Name | Type | Description |
|---|---|---|
name | string | string[] | Event name |
callback | Function | Callback function |
Returns
void
Implementation of
Inherited from
Defined in
src/common/event/eventBus.ts:11
unsubscribe
▸ unsubscribe(name): void
Unsubscribe the specific event
Parameters
| Name | Type | Description |
|---|---|---|
name | any | The event name |
Returns
void
Implementation of
Inherited from
Defined in
src/common/event/eventBus.ts:37
update
▸ update(menuId, menuItem?): void
Update the specific menu item data
Parameters
| Name | Type |
|---|---|
menuId | UniqueId |
menuItem | IMenuBarItem |
Returns
void