ngHttpPool

An angularjs module that is able to limit requests at the same time.
Homepage:
0 people use it
Submitted by: C1a1667c77d27e39e9969d3cb8a91c37?d=https%3a%2f%2fidenticons.github.com%2f1dd37bc234b1fd2c2733ccfdf10d3d60 SparrowJang

ngHttpPool

An Angularjs module that is able to limit requests at the same time.

Dependency

  • angularjs

Install

Usage

Require ngHttpPool and inject the services

Create a instance

Limit max request amounts by contructor:

Send a request

Set a http config by 'map' function:

Optionally, specify success and fail callbacks: pool.map({method:"get",url:"/"}, success, error);

Send some requests and get all of the callbacks.

Create a 'defer'. pool.listen()

Add and run requests to pool. ```

for( var index = 0; index<10 ; index++ ){

pool.map({method:"get",url:"/",params:{id:index}}); } ```

Get a promise of callbacks. ``` var promise = pool.Promise();

promise.then(function(){ console.log( "all of the callbacks." ); }); ```

Demo

Clone this project.

Install the express framework and grunt modules. npm install

run a server: grunt server

Finally,open your brower,enter http://localhost:3000/demo/index.html.

comments powered by Disqus
This page was last updated over 3 years ago.