Merge pull request #6049 from marcogrcr/add-qservice-when-method

Added resolve method to angular.IQService.
This commit is contained in:
Masahiro Wakame 2015-10-06 01:49:04 +09:00
commit bd1a814ded
2 changed files with 20 additions and 1 deletions

View File

@ -296,6 +296,17 @@ module TestQ {
result = $q.reject('');
}
// $q.resolve
{
let result: angular.IPromise<void>;
result = $q.resolve();
}
{
let result: angular.IPromise<TResult>;
result = $q.resolve<TResult>(tResult);
result = $q.resolve<TResult>(promiseTResult);
}
// $q.when
{
let result: angular.IPromise<void>;

View File

@ -1055,12 +1055,20 @@ declare module angular {
*
* @param value Value or a promise
*/
when<T>(value: IPromise<T>|T): IPromise<T>;
resolve<T>(value: IPromise<T>|T): IPromise<T>;
/**
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
*/
resolve(): IPromise<void>;
/**
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
*
* @param value Value or a promise
*/
when<T>(value: IPromise<T>|T): IPromise<T>;
/**
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
*/
when(): IPromise<void>;
}