[](https://github.com/Arjun059/)
npm install microtaskjs
npm i microtaskjs
`
or
`
yarn add microtaskjs
`
Usage
Dillinger is currently extended with the following plugins.
Instructions on how to use them in your own application are linked below.
`
const Microtask = require("microtaskjs");
function Asynctask() {
return new Promise(async (next) => {
let tasks = 3 // total tasks
let { data, event, error } = new MicroTask(tasks);
// data a promies , errror if error occur, event pass data to the event
DB.findUser().then((data) => { // use then for promise
event.emit("done", {user: data})
})
DB.findProducts().then((data) => event.emit("done", {products: data}))
DB.findPosts().then((data) => event.emit("done", {posts: data}))
data.then((data) => {
next(data)
})
})
}
``