1.1.9 • Published 2 years ago
async-track v1.1.9
Async-Track
you can use await out of a async function
installation
npm i async-track
usage
first create file async.js and a *.js file, in this case i use main.js
touch async.js main.js
then editing the main.js
require("async-track")
type somecode in async.js
//is global scoope
const test = new Promise((resolve,reject)=>{
resolve("blabla")
})
console.log(test)//Promise <pending>
//you can use
Async :
//this async scoope
let name = await test
console.log(name)//blabla
//you can use all of javascript syntax on here
const fs = require('fs')
if(true){
console.log("hello world")
}
//more something like above
then run the main.js
node main.js
you should be run the main.js or other file name which required to Async-track and you can require module to async.js file.