Comparing version 1.2.1 to 1.3.0
@@ -15,1 +15,15 @@ ## Job API | ||
``` | ||
#### getResults() | ||
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') | ||
``` |
{ | ||
"name": "fslockjs", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "Easy to use file system queue with locking and events. Provide Asynchronous utilities for Directories and File", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -100,1 +100,18 @@ # FSLockJS | ||
Which end up being a nice way to wait for the resolvement of a FS Job in concurrent conditions | ||
```js | ||
const job = await this.queue.add('File.exists', path).execution(); | ||
const isExistingFile = job.results; | ||
``` | ||
Alternatively equal to this below, that will only returns results when having it. | ||
```js | ||
const results = await this.queue.add('File.exists', path).getResults(); | ||
``` | ||
### Caveat ? | ||
Right now, an instance of FSLock only deal locally with the locks. If needed, we can make two instance working together with using real os lock. | ||
Submit issue if you need such features. |
@@ -16,2 +16,3 @@ const EventEmitter = require('events'); | ||
Job.prototype.execution = require('./methods/execution'); | ||
Job.prototype.getResults = require('./methods/getResults'); | ||
module.exports = Job; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35421
44
837
117