File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 3434## Usage
3535
3636``` javascript
37- import { createAsyncQueue } from " AsyncQueue " ;
37+ import { createAsyncQueue } from " asyncqueue-custom " ;
3838const queueProcess = createAsyncQueue ();
3939
4040// Some async function
Original file line number Diff line number Diff line change 11import { IAsyncQueue , DeferredPromise , Callback } from './model' ;
22
3+ /**
4+ * takes a single of promise. returns a promise for when asyncFunc are finished
5+ * @param {Promise } asyncFunc
6+ * @return {Promise } Promise to resolve when asyncFunc are finished
7+ */
8+
39export function createAsyncQueue < T = void > ( opts = { parallelConcurrent : false } ) : IAsyncQueue < T > {
410 const { parallelConcurrent } = opts
511 let queue : Callback < T > [ ] = [ ]
@@ -46,6 +52,17 @@ export function createAsyncQueue<T = void>(opts = { parallelConcurrent: false })
4652 }
4753}
4854
55+ /**
56+ * takes a custom parallel async function of promises. returns a promise for when all func of parallel async are finished
57+ * @param {Array } asyncFuncArray
58+ * @param {number } should parallel async run at 1 time. Default 2 async function run at the time
59+ * @return {Promise } Promise to resolve when parallel async (number config) are finished
60+ */
61+ export function createAsyncCombineQueue < T = void > ( asyncFuncArray : T [ ] = [ ] , parallelLimit : number = 2 ) : any {
4962
63+ const push = ( task : Callback < T > ) => { }
5064
65+ const start = async ( ) => { }
66+
67+ }
5168
You can’t perform that action at this time.
0 commit comments