Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AppsPortal

Class to use an unique events portal system on all the micro frontend apps enabling a centralized login system.

Example (es module)

import { AppsPortal } from '@rproenza/micro-frontend-events-portal';

const appsPortal = new AppsPortal();

const appAEventPortal = appsPortal.registerApp(registrationObjectAppA);
appAEventPortal
   .listenEvent('EVENT_APP_B-ADDED-Bss') // => appAEventPortal is now listening for 'EVENT_APP_B-ADDED-Bss' events
   .listenEvent('EVENT_APP_B-DELETED-Bss'); // => appAEventPortal is now listening for 'EVENT_APP_B-DELETED-Bss' events

const appBEventPortal = appsPortal.registerApp(registrationObjectAppB);
appBEventPortal
   .listenEvent('EVENT_APP_A-ADDED-Ass') // => appBEventPortal is now listening for 'EVENT_APP_A-ADDED-Ass' events
   .listenEvent('EVENT_APP_A-DELETED-Ass'); // => appBEventPortal is now listening for 'EVENT_APP_A-DELETED-Ass' events

appAEventPortal.notifyEvent('EVENT_APP_A-ADDED-Ass', eventPayload); // => appBEventPortal is notified about the 'EVENT_APP_A-ADDED-Ass' event
appBEventPortal.notifyEvent('EVENT_APP_B-DELETED-Bss', eventPayload); // => appAEventPortal is notified about the 'EVENT_APP_B-DELETED-Bss event

Example (commonjs)

var AppsPortal = require('@rproenza/micro-frontend-events-portal').AppsPortal;

var appsPortal = new AppsPortal();

var appAEventPortal = appsPortal.registerApp(registrationObjectAppA);
appAEventPortal
   .listenEvent('EVENT_APP_B-ADDED-Bss') // => appAEventPortal is now listening for 'EVENT_APP_B-ADDED-Bss' events
   .listenEvent('EVENT_APP_B-DELETED-Bss'); // => appAEventPortal is now listening for 'EVENT_APP_B-DELETED-Bss' events

var appBEventPortal = appsPortal.registerApp(registrationObjectAppB);
appBEventPortal
   .listenEvent('EVENT_APP_A-ADDED-Ass') // => appBEventPortal is now listening for 'EVENT_APP_A-ADDED-Ass' events
   .listenEvent('EVENT_APP_A-DELETED-Ass'); // => appBEventPortal is now listening for 'EVENT_APP_A-DELETED-Ass' events

appAEventPortal.notifyEvent('EVENT_APP_A-ADDED-Ass', eventPayload); // => appBEventPortal is notified about the 'EVENT_APP_A-ADDED-Ass' event
appBEventPortal.notifyEvent('EVENT_APP_B-DELETED-Bss', eventPayload); // => appAEventPortal is notified about the 'EVENT_APP_B-DELETED-Bss event

Hierarchy

  • AppsPortal

Index

Properties

Accessors

Methods

Properties

Private appsPortals

appsPortals: AppsPortals

Private traceLogs

traceLogs: Traces = new Traces()
property

{Traces} traceLogs - Traces instance used to save the publishing and notifying events by apps

Accessors

logs

Methods

registerApp

Generated using TypeDoc