Giter Club home page Giter Club logo

pd-meteredrequestprocessor's Introduction

Classes

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.

Typedefs

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

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

Sets the callback that will be called when an item is finished processing

Kind: instance method of meteredRequestProcessor

Param Type
cb itemCompleted

meteredRequestProcessor.setPreProcessingCB(cb) ⇒ promise

Sets the callback that will be called to add items to be processed

Kind: instance method of meteredRequestProcessor

Param Type
cb preProcessor

meteredRequestProcessor.changeConcurrentProcessing(count)

Allows you to change the total amount of simultaneous items to be procesed.

Kind: instance method of meteredRequestProcessor

Param Type
count number

meteredRequestProcessor.init(itemsToProcess) ⇒ promise

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

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

Kind: global typedef

Param Type
status string
index number

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

Kind: global typedef

Param Type
itemData *
index number

pd-meteredrequestprocessor's People

Contributors

johon8 avatar

Stargazers

Tim Murphy avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.