Skip to content
This repository has been archived by the owner on Dec 28, 2018. It is now read-only.
/ ng-q-plus Public archive

A module enhancing $q promises with additional features

License

Notifications You must be signed in to change notification settings

dbartholomae/ng-q-plus

Repository files navigation

This package is no longer supported.

ng-q-plus

NPM version Build Status Coverage Status Dependency Status devDependency Status GitHub license Gitter Greenkeeper badge

ng-q-plus is an angular module enhancing $q promises with additional features

require('angular').module 'app', [require('ng-q-plus')]
.service 'myService', ['$q', ($q) ->
  getPkmn = (i) -> $q.resolve { id: i, name: "Some gibberish name" }
  getDesc = (i) -> $q.resolve "This is pokemon " + i

  pokemons = $q.resolve [1..150]
  .map (i) ->
    getPkmn(i).set 'description', getDesc(i)
  .timeout 1000, "Uh oh, it took longer than 1 second to catch 'em all"
  .then (list) ->
    console.log JSON.stringify list, null, 2
    # Will print out
    # [
    #  { id: 1, name: "Some gibberisch name", description "This is pokemon 1" }
    #  { id: 2, name: "Some gibberisch name", description "This is pokemon 2" }
    #  ...
    #  { id: 150, name: "Some gibberisch name", description "This is pokemon 150" }
    # ]
]

CDN

The module should be available via unpkg at https://unpkg.com/ng-q-plus

No guarantees for uptime or anything like that, though.

API

The module can be required via browserify require, as an AMD module via requirejs or as a global, if window.angular is present. It creates the angular module 'ng-q-plus' and exports its name. This module augments the existing $q service, it does not create a service of its own. Each promise gets the new methods as defined in the ExtendedPromise class which can be found in the documentation.

About

A module enhancing $q promises with additional features

Resources

License

Stars

Watchers

Forks

Packages

No packages published