diff --git a/src/init.tsx b/src/init.tsx index c70174c78..17c52f9e0 100644 --- a/src/init.tsx +++ b/src/init.tsx @@ -88,4 +88,5 @@ persistStore(store, undefined, () => { dispatcher(store, logger); // make init function callable from outside window.Flipper.init = init; + window.dispatchEvent(new Event('flipper-store-ready')); }); diff --git a/static/index.dev.html b/static/index.dev.html index 54ff02b3f..c9ce6e76f 100644 --- a/static/index.dev.html +++ b/static/index.dev.html @@ -85,13 +85,10 @@ openError('Script failure. Check Chrome console for more info.'); }; - script.onload = () => { - global.Flipper.init(); - }; + window.addEventListener('flipper-store-ready', () => global.Flipper.init()); document.body.appendChild(script); } - init(); })(); diff --git a/static/index.html b/static/index.html index 773570b77..55e7ae0ed 100644 --- a/static/index.html +++ b/static/index.html @@ -13,9 +13,9 @@ - +