- meteredRequestProcessor
meteredRequestProcessor is a class that allows you to pass in multiple items to process and controls how many requests will be sent to the server at a time when all items are finished processing they will be passed to the .then of the init.
- itemCompleted :
function
The processingCompletedCallback will be passed the order number and the process status (success or fail) to trigger any completed side effects The order number is your id to locate elements (dom or whatever) based on the specific item processing
- preProcessor :
function
The index and itemData to process will be passed to this function it MUST return a native promise. the order number is your id to locate elements (dom or whatever) based on the specific item processing
meteredRequestProcessor is a class that allows you to pass in multiple items to process and controls how many requests will be sent to the server at a time when all items are finished processing they will be passed to the .then of the init.
Kind: global class
- meteredRequestProcessor
- .setItemProcessedCB(cb) ⇒
void
- .setPreProcessingCB(cb) ⇒
promise
- .changeConcurrentProcessing(count)
- .init(itemsToProcess) ⇒
promise
- .setItemProcessedCB(cb) ⇒
Sets the callback that will be called when an item is finished processing
Kind: instance method of meteredRequestProcessor
Param | Type |
---|---|
cb | itemCompleted |
Sets the callback that will be called to add items to be processed
Kind: instance method of meteredRequestProcessor
Param | Type |
---|---|
cb | preProcessor |
Allows you to change the total amount of simultaneous items to be procesed.
Kind: instance method of meteredRequestProcessor
Param | Type |
---|---|
count | number |
Starts the processing process. ItemsToProcess is an array of anything you want, but each item in this array Returns a native promise to .then off of, no need to catch, all item (success or fail) will be processed and passed to the .then the items passed to the .then will be and array of objects with the following structure { place: number, completed: boolean, status: string (success or fail) response: the data returned from the server }
Kind: instance method of meteredRequestProcessor
Param | Type |
---|---|
itemsToProcess | array |
The processingCompletedCallback will be passed the order number and the process status (success or fail) to trigger any completed side effects The order number is your id to locate elements (dom or whatever) based on the specific item processing
Kind: global typedef
Param | Type |
---|---|
status | string |
index | number |
The index and itemData to process will be passed to this function it MUST return a native promise. the order number is your id to locate elements (dom or whatever) based on the specific item processing
Kind: global typedef
Param | Type |
---|---|
itemData | * |
index | number |