ovh-angular-q-allsettled

0.3.1 • Public • Published

ovh-angular-q-allSettled

OVH components

Maintenance Chat on gitter

NPM

Copy of kriskowal/q => allSettled

Returns a promise that is fulfilled with an array of promise state snapshots, but only after all the original promises have settled, i.e. become either fulfilled or rejected.

This method is often used in its static form on arrays of promises, in order to execute a number of operations concurrently and be notified when they all finish, regardless of success or failure. For example:

Example

angular.module("app", [
  'ovh-angular-q-allSettled',
    var tinkyWinky = $q.defer(),
        dipsy = $q.defer(),
        laaLaa = $q.defer(),
        po = $q.defer();
 
    $timeout(function(){
        console.log("ok tinkyWinky");
        tinkyWinky.resolve("tinkyWinky success");
    }, 1000);
    $timeout(function(){
        console.log("error dipsy");
        dipsy.reject("dipsy error");
    }, 2000);
    $timeout(function(){
        console.log("ok laaLaa");
        laaLaa.resolve("laaLaa success");
    }, 3000);
    $timeout(function(){
        console.log("error po");
        po.reject("tutu error");
    }, 4000);
 
    $q.all([tinkyWinky.promise, dipsy.promise, laaLaa.promise, po.promise]).then(function(){
        console.log("Q ALL DONE");
        console.log(arguments);
    }, function(){
        console.log("Q ONE ERROR BUT ALL NOT DONE");
        console.log(arguments);
    });
 
    $q.allSettled([tinkyWinky.promise, dipsy.promise, laaLaa.promise, po.promise]).then(function(){
        console.log("ALL DONE");
        console.log(arguments);
    }, function(){
        console.log("ONE OR MORE ERROR");
        console.log(arguments);
    });

Installation

Bower

bower install ovh-angular-q-allsettled --save

NPM

npm install ovh-angular-q-allsettled --save

Get the sources

    git clone https://github.com/ovh-ux/ovh-angular-q-allSettled.git
    cd ovh-angular-q-allSettled
    npm install
    bower install

You've developed a new cool feature ? Fixed an annoying bug ? We'd be happy to hear from you !

Have a look in CONTRIBUTING.md

Run the tests

npm test

Related links

License

See https://github.com/ovh-ux/ovh-angular-q-allSettled/blob/master/LICENSE

Readme

Keywords

none

Package Sidebar

Install

npm i ovh-angular-q-allsettled

Weekly Downloads

0

Version

0.3.1

License

BSD-3-Clause

Last publish

Collaborators

  • anooparveti
  • jisay
  • blary_jp
  • antleblanc
  • ovh-ux-cds
  • lizardk
  • ovh
  • marie-j
  • bnjjj
  • gioindahouz
  • khuang
  • jleveugle
  • axelpeter
  • cbourgois