ezito-async
v5.0.0
Published
sync , queue , async to sync , thread party function in node.js
Downloads
8
Maintainers
Readme
Installation
npm install ezito-async
const ea = require('ezito-async');
new Promise(res => {
setTimeout(() => {
console.log("Promise end")
res(1);
}, 1000);
});
console.log("---end---");
// output frist ---end---
// and output -> Promise end
const ea = require('ezito-async');
new Promise(res => {
setTimeout(() => {
console.log("Promise end") // output second
res(1);
}, 1000);
});
console.log("---end--"); // output frist
var res = ea.sync(async result => {
await new Promise(res => {
result(1);
setTimeout(() => {
res(1);
}, 2000);
})
});
console.log(res) // output 1 called result in sync
console.log("---end--") // output the end
const ea = require('ezito-async');
const axios = require("axios");
var result = ea.loop(function(set_result){
axios.get("https://example.com").then(({ data }) => {
set_result(data)
});
});
console.log(result)