-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a89590d
commit de1c86e
Showing
14 changed files
with
399 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" style="font-size:24px;"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<style> | ||
</style> | ||
<script type="text/javascript" src="../../taskq.min.js" charset="UTF-8"></script> | ||
<script type="text/javascript" src="./script2.js" charset="UTF-8" async></script> | ||
<script type="text/javascript" src="./script0.js" charset="UTF-8" async></script> | ||
<script type="text/javascript" src="./script1.js" charset="UTF-8" async></script> | ||
</head> | ||
<body> | ||
<div class="row" style="text-align:center;padding:100px;font-size:1rem;line-height:200%"> | ||
Refresh the page with console open to see the console messages!<br> | ||
For more info see this | ||
<a href="https://blog.cloudboost.io/queued-async-pseudo-modules-with-es5-812f99fed209"> | ||
MEDIUM | ||
</a> | ||
post. | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
!function(){ | ||
function script0(){ | ||
console.log("script0 executed"); | ||
taskq.load("./scriptDynamic0.js") | ||
.then(function(){ | ||
console.log("dynamic script 0 'then' executed"); | ||
}); | ||
} | ||
script0._taskqId = "script0"; | ||
taskq.push(script0); | ||
console.log("scrip0 iief executed"); | ||
}() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
!function(){ | ||
function script1(retValue){ | ||
console.log("script1 executed"); | ||
taskq.load("./scriptDynamic1.js") | ||
.then(function(res){ | ||
res.init; | ||
setTimeout(function(){ | ||
console.log("setTimeout executed"); | ||
taskq.load("./scriptDynamic1_1.js") | ||
.then(function(res){ | ||
res.init; | ||
setTimeout(function(){ | ||
console.log("dynamic script 1_1 said: " + retValue.value); | ||
console.log("dynamic script 1_1 'then' executed"); | ||
res(true); | ||
},5000) | ||
}); | ||
console.log("finally resolving"); | ||
res(true); | ||
},10000); | ||
console.log("dynamic script 1 'then' executed"); | ||
}) | ||
.then(function(res){ | ||
res.init; | ||
setTimeout(function(){ | ||
res(false); | ||
taskq.export(false,"status"); | ||
console.log("catch will be executed, rest of the thens will be skipped."); | ||
},5000); | ||
}) | ||
.then(function(res){ | ||
res.init; | ||
setTimeout(function(){ | ||
console.log("dynamic script 1 'then-2' executed"); | ||
res(true); | ||
},5000) | ||
}) | ||
.then(function(){ | ||
console.log("dynamic script 1 'then-3' executed"); | ||
}) | ||
.catch(function(){ | ||
console.log("This is the catch function attached!"); | ||
}); | ||
} | ||
script1._taskqId = "script1"; | ||
script1._taskqWaitFor = ["script0"]; | ||
taskq.push(script1); | ||
console.log("scrip1 iief executed"); | ||
}() |
Oops, something went wrong.