[~] Refactor
This commit is contained in:
parent
32ee4316f1
commit
fd6378a643
@ -1,4 +1,6 @@
|
|||||||
(function() {
|
(async function() {
|
||||||
|
await context.loading.script.promise;
|
||||||
|
|
||||||
window.context.books.push(`
|
window.context.books.push(`
|
||||||
DEATH of a HERO
|
DEATH of a HERO
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
window.context = {};
|
window.context = {};
|
||||||
|
window.context.loading = {};
|
||||||
window.context.books = [];
|
window.context.books = [];
|
||||||
</script>
|
</script>
|
||||||
<script src="NoSleep.min.js"></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', () => {
|
$(window).on('load', () => {
|
||||||
|
|
||||||
var synth = window.speechSynthesis;
|
var synth = window.speechSynthesis;
|
||||||
@ -505,4 +520,6 @@ $(window).on('load', () => {
|
|||||||
voiceSelect.onchange = function(){
|
voiceSelect.onchange = function(){
|
||||||
speak();
|
speak();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context.loading.script.resolve(true);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user