mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
angularjs: changed $timeout signature, added tests
This commit is contained in:
parent
bb45306d0f
commit
7652914a5b
@ -381,6 +381,45 @@ var scope: ng.IScope = element.scope();
|
||||
var isolateScope: ng.IScope = element.isolateScope();
|
||||
|
||||
|
||||
// $timeout signature tests
|
||||
module TestTimeout {
|
||||
interface TResult {
|
||||
a: number;
|
||||
b: string;
|
||||
c: boolean;
|
||||
}
|
||||
var fnTResult: (...args: any[]) => TResult;
|
||||
var promiseAny: angular.IPromise<any>;
|
||||
var $timeout: angular.ITimeoutService;
|
||||
|
||||
// $timeout
|
||||
{
|
||||
let result: angular.IPromise<any>;
|
||||
result = $timeout();
|
||||
}
|
||||
{
|
||||
let result: angular.IPromise<void>;
|
||||
result = $timeout(1);
|
||||
result = $timeout(1, true);
|
||||
}
|
||||
{
|
||||
let result: angular.IPromise<TResult>;
|
||||
result = $timeout(fnTResult);
|
||||
result = $timeout(fnTResult, 1);
|
||||
result = $timeout(fnTResult, 1, true);
|
||||
result = $timeout(fnTResult, 1, true, 1);
|
||||
result = $timeout(fnTResult, 1, true, 1, '');
|
||||
result = $timeout(fnTResult, 1, true, 1, '', true);
|
||||
}
|
||||
|
||||
// $timeout.cancel
|
||||
{
|
||||
let result: boolean;
|
||||
result = $timeout.cancel();
|
||||
result = $timeout.cancel(promiseAny);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function test_IAttributes(attributes: ng.IAttributes){
|
||||
return attributes;
|
||||
|
||||
5
angularjs/angular.d.ts
vendored
5
angularjs/angular.d.ts
vendored
@ -725,8 +725,9 @@ declare module angular {
|
||||
// see http://docs.angularjs.org/api/ng.$timeout
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ITimeoutService {
|
||||
<T>(func: (...args: any[]) => T, delay?: number, invokeApply?: boolean): IPromise<T>;
|
||||
cancel(promise: IPromise<any>): boolean;
|
||||
(delay?: number, invokeApply?: boolean): IPromise<void>;
|
||||
<T>(fn: (...args: any[]) => T, delay?: number, invokeApply?: boolean, ...args: any[]): IPromise<T>;
|
||||
cancel(promise?: IPromise<any>): boolean;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Loading…
Reference in New Issue
Block a user