From a7f5be4c8e5950b00a54fc13095180fff84eb2f0 Mon Sep 17 00:00:00 2001 From: Siarhei Siniak Date: Sat, 24 Aug 2024 12:42:13 +0300 Subject: [PATCH] [~] Refactor --- d2/book1/script.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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',