@pcmnac/single-spa-cycle
v1.0.1
Published
a single spa plugin for cycle.js apps
Downloads
12
Readme
single-spa-cycle
a single-spa plugin for cycle.js applications (adapted from CanopyTax/single-spa-react)
Generic lifecycle hooks for Cycle.js applications that are registered as child applications of single-spa.
Quickstart
First, in the child application, run npm install --save @pcmnac/single-spa-cycle
. Then, in your child app's entry file, do the following:
import {run} from '@cycle/run'
import {makeDOMDriver} from '@cycle/dom'
import singleSpaCycle from '@pcmnac/single-spa-cycle';
import rootComponent from './root.component.js';
const cycleLifecycles = singleSpaCycle({
run,
rootComponent,
drivers: { DOM: makeDOMDriver(document.getElementById('main-content'))}, // or { DOM: makeDOMDriver('#main-content')}
});
export const bootstrap = [
cycleLifecycles.bootstrap
];
export const mount = [
cycleLifecycles.mount
];
export const unmount = [
cycleLifecycles.unmount
];
Options
All options are passed to single-spa-cycle via the opts
parameter when calling singleSpaCycle(opts)
. The following options are available:
run
: (required) Cycle.js run function.drivers
: (required) Drivers (including DOM Driver) to be used by your Cycle.js root component.rootComponent
: (required) The top level Cycle.js component which will be rendered