Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- var send = function send(param) {
- return new Promise(function (resolve, reject) {
- console.log("ici send");
- find(function () {
- console.log("ici callback");
- });
- if (true) {
- resolve("resolve " + param);
- } else {
- reject("reject " + param);
- }
- });
- };
- function find(callback) {
- console.log("ici find :");
- setTimeout(callback, 2000);
- };
- console.log("start");
- send("toto").then(function (res) {
- console.log("ici then :", res);
- });
- console.log("end");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement