a single-spa plugin for cycle.js applications
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.babelrc
.gitignore
.npmignore
LICENSE
README.md
package-lock.json
package.json

README.md

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