task-serializer
Advanced tools
Comparing version 1.2.0 to 2.0.0
@@ -26,3 +26,3 @@ 'use strict'; | ||
async function main(){ | ||
let ai=new AsyncIter(2); | ||
let ai=new AsyncIter({concurrentTaskLimit:2}); | ||
await Promise.all([producer(ai),consumer(ai)]); | ||
@@ -29,0 +29,0 @@ } |
{ | ||
"name": "task-serializer", | ||
"version": "1.2.0", | ||
"version": "2.0.0", | ||
"description": "Serialize tasks/promises for integrated control. Option for limiting number of concurrent tasks.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -350,3 +350,5 @@ copyright 2020 craigphicks ISC license | ||
- `const {AsyncIter}=require('task-serializer')` | ||
- `instance=new AsyncIter({concurrentTaskLimit=0}={})` | ||
- `AsyncIter.constructor({concurrentTaskLimit=0}={})` | ||
- `AsyncIter.constructor(concurrentTaskLimit=0)` | ||
- Either form of constructor (named/unnamed param) are allowed.. | ||
- See [API shared by all classes](#api-shared-by-all-classes). | ||
@@ -373,3 +375,5 @@ - explicit async `instance.next()` or implicit async `for await (iter of instance)` | ||
- `const {NextSymbol}=require('task-serializer')` | ||
- `instance=new NextSymbol({concurrentTaskLimit=0}={})` | ||
- `NextSymbol.constructor({concurrentTaskLimit=0}={})` | ||
- `NextSymbol.constructor(concurrentTaskLimit=0)` | ||
- Either form of constructor (named/unnamed param) are allowed.. | ||
- See [API shared by all classes](#api-shared-by-all-classes). | ||
@@ -391,3 +395,5 @@ - async `instance.nextSymbol()` | ||
- `const {WaitAll}=require('task-serializer')` | ||
- `instance=new WaitAll({concurrentTaskLimit=0}={})` | ||
- `WaitAll.constructor({concurrentTaskLimit=0}={})` | ||
- `WaitAll.constructor(concurrentTaskLimit=0)` | ||
- Either form of constructor (named/unnamed param) are allowed.. | ||
- See [API shared by all classes](#api-shared-by-all-classes). | ||
@@ -406,3 +412,5 @@ - async `instance.waitAll()` | ||
- `const {Callbacks}=require('task-serializer')` | ||
- `instance=new Callbacks({concurrentTaskLimit=0}={})` | ||
- `Callbacks.constructor({concurrentTaskLimit=0}={})` | ||
- `Callbacks.constructor(concurrentTaskLimit=0)` | ||
- Either form of constructor (named/unnamed param) are allowed.. | ||
- See [API shared by all classes](#api-shared-by-all-classes). | ||
@@ -409,0 +417,0 @@ - `instance.onTaskResolved(callback)` |
@@ -6,4 +6,6 @@ 'use strict'; | ||
class AsyncIter { | ||
constructor(initCount){ | ||
this._sts=new TaskSerializer(initCount); | ||
constructor({concurrentTaskLimit=0}={}){ | ||
if (Object.keys(arguments).includes('0')) | ||
concurrentTaskLimit=arguments['0']; | ||
this._sts=new TaskSerializer(concurrentTaskLimit); | ||
this._q=[]; | ||
@@ -10,0 +12,0 @@ this._qe=[]; |
@@ -6,4 +6,6 @@ /* eslint-disable no-unused-vars */ | ||
class Callbacks{ | ||
constructor({concurrentLimit=0}={}){ | ||
this._ts=new TaskSerializer(concurrentLimit); | ||
constructor({concurrentTaskLimit=0}={}){ | ||
if (Object.keys(arguments).includes('0')) | ||
concurrentTaskLimit=arguments['0']; | ||
this._ts=new TaskSerializer(concurrentTaskLimit); | ||
} | ||
@@ -10,0 +12,0 @@ onTaskResolved(cb){this._ts.onTaskResolved(cb);} |
const {TaskSerializer}=require('./task-serializer.js'); | ||
class NextSymbol{ | ||
constructor({ | ||
concurrentTaskLimit=0, | ||
}={}){ | ||
constructor({concurrentTaskLimit=0,}={}){ | ||
if (Object.keys(arguments).includes('0')) | ||
concurrentTaskLimit=arguments['0']; | ||
this._ts=new TaskSerializer(concurrentTaskLimit); | ||
@@ -7,0 +7,0 @@ this._result=TaskSerializer._makepr(); |
const {TaskSerializer}=require('./task-serializer.js'); | ||
class WaitAll{ | ||
constructor({concurrentLimit=0}={}){ | ||
this._ts=new TaskSerializer(concurrentLimit); | ||
constructor({concurrentTaskLimit=0}={}){ | ||
if (Object.keys(arguments).includes('0')) | ||
concurrentTaskLimit=arguments['0']; | ||
this._ts=new TaskSerializer(concurrentTaskLimit); | ||
this._results=[]; | ||
@@ -6,0 +8,0 @@ this._error=TaskSerializer._makepr(); |
@@ -17,3 +17,3 @@ 'use strict'; | ||
async function main(){ | ||
let ai=new AsyncIter(2); | ||
let ai=new AsyncIter({concurrentTaskLimit:2}); | ||
await Promise.all([producer(ai),consumer(ai)]); | ||
@@ -20,0 +20,0 @@ } |
@@ -17,3 +17,3 @@ 'use strict'; | ||
async function main(){ | ||
let ai=new AsyncIter(2); | ||
let ai=new AsyncIter({concurrentTaskLimit:2}); | ||
await Promise.all([producer(ai),consumer(ai)]); | ||
@@ -20,0 +20,0 @@ } |
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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
60988
36
1307
0
424
1