Pause app boot until window load event fired #21

Merged
galfert merged 2 commits from feature/wait_for_web3 into master 2017-06-13 12:37:20 +00:00
2 changed files with 11 additions and 0 deletions
Showing only changes of commit 993cd85e4a - Show all commits
+6
View File
@@ -13,6 +13,12 @@
<link rel="stylesheet" href="{{rootURL}}assets/kredits-web.css"> <link rel="stylesheet" href="{{rootURL}}assets/kredits-web.css">
{{content-for "head-footer"}} {{content-for "head-footer"}}
<script>
window.addEventListener('load', function() {
window.windowLoadComplete = true;
});
</script>
</head> </head>
<body> <body>
{{content-for "body"}} {{content-for "body"}}
+5
View File
@@ -6,9 +6,14 @@
export default { export default {
name: 'defer-loading', name: 'defer-loading',
initialize: function(application) { initialize: function(application) {
// Load event already fired, so web3 should be loaded if available
if (window.windowLoadComplete) { return true; }
// Pause app loading
application.deferReadiness(); application.deferReadiness();
window.addEventListener('load', function() { window.addEventListener('load', function() {
// Continue app loading
application.advanceReadiness(); application.advanceReadiness();
}); });
} }