single-spa-riot is a helper library that helps implement single-spa registered application lifecycle functions (bootstrap, mount and unmount) for for use with riot. Check out the single-spa-riot github.

NPM

Build Status

minified

Installation

  1. npm install --save single-spa-riot

Usage

  1. import * as Riot from 'riot';
  2. import singleSpaRiot from 'single-spa-riot';
  3. import App from './App.riot'
  4. const riotLifecycles = singleSpaRiot({
  5. rootComponent: Riot.component(App),
  6. domElementGetter: () => document.getElementById('#app')
  7. });
  8. export const bootstrap = riotLifecycles.bootstrap;
  9. export const mount = riotLifecycles.mount;
  10. export const unmount = riotLifecycles.unmount;

Options

All options are passed to single-spa-riot via the opts parameter when calling singleSpaRiot(opts). The following options are available:

  • domElementGetter: (required) the callback to get root component mount element.
  • rootComponent: (optional and replaces appOptions.loadRootComponent) the root riot component.
  • loadRootComponent: (optional and replaces appOptions.rootComponent) A promise that resolves with your root component. This is useful for lazy loading.