fslockjs
Version:
Easy to use file system queue with locking and events. Provide Asynchronous utilities for Directories and File
29 lines (21 loc) • 560 B
Markdown
Allow to wait to execution of a task.
```js
const job = new Job({command, path, params});
setTimeout(()=>{
job.emit('executed');
},500)
await job.execution();
console.log('500ms later. Do other stuff')
```
Tries to get the results, waits for execution before retuning it
```js
const job = new Job({command, path, params});
setTimeout(()=>{
job.emit('executed');
},500)
const res = await job.getResults();
console.log('500ms later. Do thing with res')
```