[~] Refactor

This commit is contained in:
Siarhei Siniak 2024-08-24 12:26:16 +03:00
parent 32ee4316f1
commit fd6378a643
3 changed files with 21 additions and 1 deletions

@ -1,4 +1,6 @@
(function() {
(async function() {
await context.loading.script.promise;
window.context.books.push(`
DEATH of a HERO

@ -15,6 +15,7 @@
<script>
window.context = {};
window.context.loading = {};
window.context.books = [];
</script>
<script src="NoSleep.min.js"></script>

@ -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);
});