1.0.9 • Published 2 years ago

@uncover/js-utils-microfrontend v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

js-utils-microfrontend

npm version Last Push

js-utils-microfrontend is a small JavaScript library providing tools to ease microfrontend development regardless of the chosen frameworks.

It provides seamless communication between existing frames by sending standardized messages.

Concept

TBD

Usage

Installation

npm add @uncover/js-utils-microfrontend

Starting the dispatcher

Once in each frame, start the message dispatcher.

import MessageDispatcher from '@uncover/js-utils-microfrontend'

MessageDispatcher.start()

Using message services

Create new MessageService instances and initialize them with a callback. This callback will be called everytime another service emits a message.

import {
  Message,
  MessageService,
} from '@uncover/js-utils-microfrontend'

const myService = new MessageService()
myService.init((message: Message) => console.log(message))

Send messages respecting the Message interface:

  • type: string
  • payload: any
const message: Message = {
  type: 'ActionType',
  payload: { data: 'ActionPayload' }
}
myService.sendMessage(message)
1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago