UNPKG

fslockjs

Version:

Easy to use file system queue with locking and events. Provide Asynchronous utilities for Directories and File

24 lines (21 loc) 500 B
const processQueue = async (self) => { if (self.queue.length > 0) { await self.processNext(); // We check if there is other tasks to perform await processQueue(self); } }; async function processAll() { this.state = 'processingAll'; const self = this; if (this.queue.length === 0) { this.state = 'idle'; return; } if (self.options.autoexec && !self.autoExecStarted) { return; } await processQueue(self); this.state = 'idle'; }; export default processAll;