[~] 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(`
|
||||
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);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user