diff --git a/d2/book1/script.js b/d2/book1/script.js index 3179a36..2ca4de0 100644 --- a/d2/book1/script.js +++ b/d2/book1/script.js @@ -13,7 +13,7 @@ class Future { context.loading.script = new Future(); -$(window).on('load', () => { +$(window).on('load', async () => { var synth = window.speechSynthesis; @@ -339,7 +339,7 @@ $(window).on('load', () => { //voiceSelect.selectedIndex = selectedIndex; }, - init: () => { + init: async () => { let state = context.callbacks.get_state(); context.ui.voice_select.val(state.voice); if (!state.book_id) @@ -358,7 +358,7 @@ $(window).on('load', () => { } if (state.book_url) { - context.callbacks.book_add(state.book_url); + await context.callbacks.book_add(state.book_url); state.book_id = context.books.length - 1; } @@ -382,7 +382,7 @@ $(window).on('load', () => { speechSynthesis.onvoiceschanged = context.callbacks.populateVoiceList; } - context.callbacks.init(); + await context.callbacks.init(); context.ui.add_book.on( 'click',