Last active
March 13, 2018 17:15
-
-
Save alterx/2473fd01ae32a4c025a5846e99c2c07d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const draw = (newModule: Function, reRender: boolean = true): void => { | |
if (!platform) { | |
try { | |
enableProdMode(); | |
} catch (e) {} | |
platform = platformBrowserDynamic(); | |
promises.push(platform.bootstrapModule(newModule)); | |
} else { | |
Promise.all(promises).then(modules => { | |
modules.forEach(mod => mod.destroy()); | |
const body = document.body; | |
const app = document.createElement('storybook-dynamic-app-root'); | |
body.appendChild(app); | |
promises = []; | |
promises.push(platform.bootstrapModule(newModule)); | |
}); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment