promises
This commit is contained in:
parent
a68022a8d6
commit
04b2fcfba2
17 changed files with 304 additions and 137 deletions
19
archive/promise/thenable2.js
Normal file
19
archive/promise/thenable2.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
'use strict';
|
||||
|
||||
new Promise()
|
||||
.then(result => {
|
||||
return {
|
||||
then(resolve, reject) {
|
||||
setTimeout(() => resolve("two"), 1000);
|
||||
}
|
||||
};
|
||||
})
|
||||
.then(result => {
|
||||
console.log("HERE", result);
|
||||
return result;
|
||||
})
|
||||
.then(console.log)
|
||||
.catch(err => console.error("ERROR", err));
|
||||
|
||||
// https://tc39.github.io/ecma262/#sec-promise-resolve-functions
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue