Class: MenuBarService
molecule.MenuBarService
Hierarchy
Implements
Constructors
constructor
• new MenuBarService()
Overrides
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
Overrides
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
Name | Type |
---|---|
menuItem | IMenuBarItem |
parentId | UniqueId |
Returns
void
Implementation of
Defined in
services/workbench/menuBarService.ts:106
count
▸ count(name
): number
Count the service event
Parameters
Name | Type | Description |
---|---|---|
name | string | Event name |
Returns
number
Implementation of
Inherited from
Defined in
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
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
services/workbench/menuBarService.ts:95
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
services/workbench/menuBarService.ts:70
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
services/workbench/menuBarService.ts:168
onUpdateState
▸ onUpdateState(listener
): void
Listen to the Component state update event
Parameters
Name | Type |
---|---|
listener | (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
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
Name | Type |
---|---|
listener? | Function |
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
services/workbench/menuBarService.ts:162
setMenus
▸ setMenus(menuData
): void
Set the menus data
Parameters
Name | Type |
---|---|
menuData | IMenuBarItem [] |
Returns
void
Implementation of
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
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
, listener
): void
Subscribe the service event
Parameters
Name | Type | Description |
---|---|---|
name | string | string [] | Event name |
listener | Function | Listener function |
Returns
void
Implementation of
Inherited from
Defined in
unsubscribe
▸ unsubscribe(name
, listener?
): void
Unsubscribe the specific event and the listener function
Parameters
Name | Type | Description |
---|---|---|
name | any | The event name |
listener? | Function | optional, it unsubscribes events via name if not pass the listener function |
Returns
void
Implementation of
Inherited from
Defined in
update
▸ update(menuId
, menuItem?
): void
Update the specific menu item data
Parameters
Name | Type |
---|---|
menuId | UniqueId |
menuItem | IMenuBarItem |
Returns
void