0.1.0 • Published 1 year ago

orchy-menu-plugin v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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'}
    )
0.1.0

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago