diff --git a/app/index.html b/app/index.html index 37dc05a..c2635b4 100644 --- a/app/index.html +++ b/app/index.html @@ -13,6 +13,12 @@ {{content-for "head-footer"}} + + {{content-for "body"}} diff --git a/app/initializers/defer-loading.js b/app/initializers/defer-loading.js new file mode 100644 index 0000000..6cd1b14 --- /dev/null +++ b/app/initializers/defer-loading.js @@ -0,0 +1,20 @@ +/** + * This pauses the app's boot process until the window load event is fired. + * It allows the user provided Web3 instance (e.g. Metamask, Mist Browser) + * to be inserted before we try to use it. + */ +export default { + name: 'defer-loading', + initialize: function(application) { + // Load event already fired, so web3 should be loaded if available + if (window.windowLoadComplete) { return true; } + + // Pause app loading + application.deferReadiness(); + + window.addEventListener('load', function() { + // Continue app loading + application.advanceReadiness(); + }); + } +};