Improve waiting for window.onload

In case the window load event was fired before getting to the Ember
initializer, it would pause app loading indefinitely. This makes sure
that app loading is only paused, if there's still an event to wait for.
This commit is contained in:
basti committed 2017-06-13 14:27:09 +02:00
1 parent e51586a78c
commit 993cd85e4a
2 files changed
+11

No files matched your search

+6
View File
@@ -13,6 +13,12 @@
<link rel="stylesheet" href="{{rootURL}}assets/kredits-web.css">
{{content-for "head-footer"}}
<script>
window.addEventListener('load', function() {
window.windowLoadComplete = true;
});
</script>
</head>
<body>
{{content-for "body"}}
+5
View File
@@ -6,9 +6,14 @@
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();
});
}