one-spa-riot
one-spa-riot is a helper library that helps implement one-spa registered application lifecycle functions (bootstrap, mount and unmount) for for use with riot. Check out the one-spa-riot github.
Installation
npm install --save one-spa-riot
Usage
import * as Riot from "riot";
import oneSpaRiot from "one-spa-riot";
import App from "./App.riot";
const riotLifecycles = oneSpaRiot({
rootComponent: Riot.component(App),
domElementGetter: () => document.getElementById("#app"),
});
export const bootstrap = riotLifecycles.bootstrap;
export const mount = riotLifecycles.mount;
export const unmount = riotLifecycles.unmount;
Options
All options are passed to one-spa-riot via the opts parameter when calling oneSpaRiot(opts). The following options are available:
domElementGetter: (required) the callback to get root component mount element.rootComponent: (optional and replacesappOptions.loadRootComponent) the root riot component.loadRootComponent: (optional and replacesappOptions.rootComponent) A promise that resolves with your root component. This is useful for lazy loading.