@ringcentral/mfe-service-worker
TypeScript icon, indicating that this package has built-in type declarations

0.3.8 • Public • Published

@ringcentral/mfe-service-worker

Node CI

A micro frontends framework for building Web applications

Usage

npm install @ringcentral/mfe-service-worker
# or
yarn add @ringcentral/mfe-service-worker

You can visit https://github.com/ringcentral/ringcentral-mfe for more documentation.

  1. init service worker
importScripts('/public-path/service-worker.mfe.js');

const subAppServiceWorkerManager = new mfe.SubAppServiceWorkerManager();

subAppServiceWorkerManager.listener();
  1. register service worker
import mfe from '@ringcentral/mfe-service-worker';

await navigator.serviceWorker.register('/service-worker.js').then((res) => {
  console.log('[MAIN] register success');
});

// receive prefixes parmas which will match request path, if matched, will
// return cache file
mfe
  .registerSubApp({
    name: 'phone',
    scope: 'https://app.ringcentral.com/mfe/platform/23.2.10/',
    version: '0.0.1',
    manifestRelativePath: 'precache-manifest',
  })
  .then(() => {
    console.log('phone register success');
  });
  1. add webpack plugin
import { GenerateManifestWebpackPlugin } from '@ringcentral/mfe-service-worker/generate-manifest-webpack-plugin';
{
    plugin: [
      new GenerateManifestWebpackPlugin();
    ]
}

Readme

Keywords

Package Sidebar

Install

npm i @ringcentral/mfe-service-worker

Weekly Downloads

3

Version

0.3.8

License

MIT

Unpacked Size

127 kB

Total Files

81

Last publish

Collaborators

  • tylerlong
  • kirill.konshin