Skip to content

Instantly share code, notes, and snippets.

@cggaurav
Created August 27, 2014 23:02
Show Gist options
  • Save cggaurav/fc0c1fc3af3e10f1ae63 to your computer and use it in GitHub Desktop.
Save cggaurav/fc0c1fc3af3e10f1ae63 to your computer and use it in GitHub Desktop.
qq.
QQ = angular.module 'QQ', []
# Enables Angular 1.3.x-like $q functionality. Example:
# qq (resolve, reject, notify) ->
# obj = doSomething 'parameter', resolve, reject
# obj.onprogress = notify
QQ.factory 'qq', ($q) ->
qq = (fn) ->
deferred = $q.defer()
fn deferred.resolve, deferred.reject, deferred.notify
deferred.promise
qq.all = $q.all
qq.defer = $q.defer
qq.reject = $q.reject
qq.when = $q.when
qq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment