diff --git a/d2/book1/book.js b/d2/book1/book.js index f92928e..6612937 100644 --- a/d2/book1/book.js +++ b/d2/book1/book.js @@ -1,4 +1,6 @@ -(function() { +(async function() { + await context.loading.script.promise; + window.context.books.push(` DEATH of a HERO diff --git a/d2/book1/index.html b/d2/book1/index.html index c406473..7bfcd56 100644 --- a/d2/book1/index.html +++ b/d2/book1/index.html @@ -15,6 +15,7 @@ diff --git a/d2/book1/script.js b/d2/book1/script.js index c5164d8..7841f6d 100644 --- a/d2/book1/script.js +++ b/d2/book1/script.js @@ -1,3 +1,18 @@ +class Future { + constructor() { + let self = this; + + self.promise = new Promise( + (resolve, reject) => { + self.resolve = resolve; + self.reject = reject; + } + ); + } +} + +context.loading.script = new Future(); + $(window).on('load', () => { var synth = window.speechSynthesis; @@ -505,4 +520,6 @@ $(window).on('load', () => { voiceSelect.onchange = function(){ speak(); } + + context.loading.script.resolve(true); });