mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
This can be used internally to remove the repeating pattern of `obj && obj.then`. For now, I don't see a good reason to expose this in angular's public interface. Conflicts: src/Angular.js
20 lines
538 B
JavaScript
20 lines
538 B
JavaScript
/* global qFactory: false */
|
|
'use strict';
|
|
|
|
var isFunction = function isFunction(value){return typeof value == 'function';};
|
|
var isPromiseLike = function isPromiseLike(obj) {return obj && isFunction(obj.then);};
|
|
|
|
var $q = qFactory(process.nextTick, function noopExceptionHandler() {});
|
|
|
|
exports.fulfilled = $q.resolve;
|
|
exports.rejected = $q.reject;
|
|
exports.pending = function () {
|
|
var deferred = $q.defer();
|
|
|
|
return {
|
|
promise: deferred.promise,
|
|
fulfill: deferred.resolve,
|
|
reject: deferred.reject
|
|
};
|
|
};
|