Skip to content

Instantly share code, notes, and snippets.

@alterx
Last active March 13, 2018 17:15
Show Gist options
  • Save alterx/2473fd01ae32a4c025a5846e99c2c07d to your computer and use it in GitHub Desktop.
Save alterx/2473fd01ae32a4c025a5846e99c2c07d to your computer and use it in GitHub Desktop.
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