orchy-menu-plugin
v0.1.0
Published
orchy plugin for menu manager
Downloads
2
Readme
orchy-menu-plugin
This plugin allows comunicate register and unRegister of menu items from microfrontends using the orchy's eventBus
.
Plugin configuration
The plugin expose a function to create an API object:
createMenuApi
: unique parameter aseventBus
: theorchy's eventBus
instance.
The avaible API are:
registerMenu
: send event for add new menu itemunregisterMenu
: send event for remove menu item
Menu Item
The structure of menu item is:
{
"label": "string",
"url": "string",
"name": "string",
"microfronted": "string"
}
Exampe of usage
Config shell app for recevice events:
...
...
const menuApi : createMenuApi(eventBus)
menuApi.menuItems$.subscribe({
next: (menuItems) => {
// menuItems is array menu item
}
})
Config microfrontend for send events:
...
...
const menuApi : createMenuApi(eventBus)
menuApi.registerMenu(
{label: 'Click Here', url: '#', name: 'test-link', microfrontet: 'mfe-1'}
)
menuApi.unregisterMenu(
{name: 'test-link', microfrontet: 'mfe-1'}
)