mos-fame-event-module
v1.0.9
Published
This library is running inside each module. It is used for
Downloads
5
Readme
Frame application library
This library is running inside each module. It is used for
- Communication between frame app and module
- Synchronize the browsers localization
Usage
To include it in a module, add
Browser
<script async type="module" src="https://frame.prototype.dev-blue.com/lib/dist/browser/MosFrameModule.js"></script>
to your site, then a window.MosFrameModule will be available golobally
React
import mosMod from 'mos-fame-event-module'
mosMod.init() // if it is not already initiated
build
npm run build
yarn build
A dist folder will be generated with this structure
As you can see we have browser build (for old javascript app, the global MosFrameModule variable will be available under window object)
index.es.js for react app (and any application that uses ES6 import)
we omitted cjs build in this case because we won't be using this module in node environement
Deployment
NPM
a simple npm publish
will be enough to publish to npm, make sure to pump the version first
Browser
The library has to be served from a server which has CORS enabled.
Tree shaking
to analyze and visualize the bundle size, we can use the analyzer folder like this:
npm run analyzer-stats // to generate stats.json about our build npm run analyzer // to use the stats.json and generate bundle visualizer in your default browser