Last active
October 5, 2018 22:11
-
-
Save joeldenning/d72c28eb395665849b5fd311f33272f2 to your computer and use it in GitHub Desktop.
A simple root-application.js file for single-spa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {declareChildApplication, start} from 'single-spa'; | |
// Register your first application with single-spa. More apps will be registered as you create them | |
declareChildApplication("cool-app", loadCoolApp, isCoolAppActive); | |
// Tell single-spa that you're ready for it to mount your application to the DOM | |
start(); | |
// This is a "loading function" | |
function loadCoolApp() { | |
return import("./cool-app/cool.app.js"); | |
} | |
// This is an "activity function" | |
function isCoolAppActive() { | |
return window.location.hash.startsWith("#/cool"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your medium article that references this is almost two years old, but it still stands as one of the best annotated guides. Consider updating
declareChildApplication
toregisterApplication
.