[~] Refactor

This commit is contained in:
Siarhei Siniak 2024-08-24 12:42:13 +03:00
parent 392faf5526
commit a7f5be4c8e

@ -13,7 +13,7 @@ class Future {
context.loading.script = new Future(); context.loading.script = new Future();
$(window).on('load', () => { $(window).on('load', async () => {
var synth = window.speechSynthesis; var synth = window.speechSynthesis;
@ -339,7 +339,7 @@ $(window).on('load', () => {
//voiceSelect.selectedIndex = selectedIndex; //voiceSelect.selectedIndex = selectedIndex;
}, },
init: () => { init: async () => {
let state = context.callbacks.get_state(); let state = context.callbacks.get_state();
context.ui.voice_select.val(state.voice); context.ui.voice_select.val(state.voice);
if (!state.book_id) if (!state.book_id)
@ -358,7 +358,7 @@ $(window).on('load', () => {
} }
if (state.book_url) 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; state.book_id = context.books.length - 1;
} }
@ -382,7 +382,7 @@ $(window).on('load', () => {
speechSynthesis.onvoiceschanged = context.callbacks.populateVoiceList; speechSynthesis.onvoiceschanged = context.callbacks.populateVoiceList;
} }
context.callbacks.init(); await context.callbacks.init();
context.ui.add_book.on( context.ui.add_book.on(
'click', 'click',