Skip to content

DevShoesed/orchy-menu-plugin

Repository files navigation

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 as eventBus: the orchy's eventBus instance.

The avaible API are:

  • registerMenu: send event for add new menu item
  • unregisterMenu: 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'}
    )

About

Orchy plugin for menu manager

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published