diff --git a/lectureExamples/newFetch.html b/lectureExamples/newFetch.html index aa9e0905734fe8f1035f1d933d9a14e4521e6da3..1f8affd6b5e63fe6389e95d5c13986b655f82617 100644 --- a/lectureExamples/newFetch.html +++ b/lectureExamples/newFetch.html @@ -32,15 +32,41 @@ }) } + let prom = new Promise((resolve, reject) => { + resolve('I am running in the initial tick') + }) + + new Promise((resolve, reject) => { + resolve('testing a theory') + }).then(message => { + console.log(message) + }).then((value) => { + console.log('showing interleaveing') + }) let result = newFetch(data) newFetch(data) .then(result => { - console.log('printing from newFetch') + setTimeout(() => { + console.log('printing from newFetch')} + , 1000) console.log(result) + }) + .then(() => { + console.log('always will grint before "printing from newFetch" ') }) .catch(err => console.error(err)) + + console.log('at the bottom of the script') + prom + .then((message) => { + console.log(message) + return "this will be wrapped" + }) + .then(message => { + console.log(message) + }) </script> </body>