@heyrohit/

promises-1

Nodejs

No description

fork
loading
Files
  • index.js

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.4363883716253347","path":"index.js","file":{"path":"index.js","content":{"asEncoding":{"base64":"ZnVuY3Rpb24gZ2V0UHJvbWlzZSgpIHsKICBjb25zdCB0YXNrUHJvbWlzZSA9IG5ldyBQcm9taXNlKChyZXNvbHZlLCByZWplY3QpID0+IHsKICAgIGNvbnNvbGUubG9nKCJ0YXNrIHN0YXJ0ZWQuIik7CiAgICAKICAgIHNldFRpbWVvdXQoKCkgPT4gewogICAgICBjb25zb2xlLmxvZygiZG9uZSBhZnRlciAxMDBtcy4iKTsKICAgICAgcmVzb2x2ZSgpOwogICAgfSwgMTAwKTsKICB9KTsKICAKICByZXR1cm4gdGFza1Byb21pc2U7Cn0KCmdldFByb21pc2UoKTs="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function getPromise() {
  const taskPromise = new Promise((resolve, reject) => {
    console.log("task started.");
    
    setTimeout(() => {
      console.log("done after 100ms.");
      resolve();
    }, 100);
  });
  
  return taskPromise;
}

getPromise();
node v10.16.0