forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ng-command.d.ts
51 lines (44 loc) · 1.37 KB
/
ng-command.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Type definitions for ng-command 0.2.0
// Project: https://github.com/stephenlautier/ng-command
// Definitions by: Stephen Lautier <https://github.com/stephenlautier>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../angularjs/angular.d.ts" />
declare module ngCommand {
var ModuleName: string;
/**
* Command proxy object.
*/
interface ICommand {
/**
* Determines whether the command is currently executing.
*/
isExecuting: boolean;
/**
* Determines whether the command can execute or not.
*/
canExecute: boolean;
/**
* Executes the command function.
*/
execute: () => angular.IPromise<any>;
}
class Command implements ICommand {
static id: string;
isExecuting: boolean;
canExecute: boolean;
constructor($scope: angular.IScope, execute: () => angular.IPromise<any>, canExecute?: () => boolean);
execute(): angular.IPromise<any>;
}
/**
* Command factory which creates instances of @see ICommand.
*/
interface ICommandFactory {
/**
* Factory instance creator method.
* @param $scope Scope which will keep track of the command.
* @param execute The execute function when the command is executed.
* @param canExecute Additional function which determines whether the command can executes.
*/
($scope: angular.IScope, execute: () => angular.IPromise<any>, canExecute?: () => boolean): ICommand;
}
}