forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ladda.d.ts
67 lines (53 loc) · 1.74 KB
/
ladda.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Type definitions for Ladda 0.9.4
// Project: https://github.com/hakimel/Ladda
// Definitions by: Danil Flores <https://github.com/dflor003/>, Michael Lee <https://github.com/leemicw>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
interface ILaddaButton {
start(): ILaddaButton;
startAfter(delay: number): ILaddaButton
stop(): ILaddaButton;
toggle(): ILaddaButton;
setProgress(progress: number): ILaddaButton;
enable(): ILaddaButton;
disable(): ILaddaButton;
isLoading(): boolean;
remove(): void;
}
interface ILaddaOptions {
timeout?: number;
callback?: (instance: ILaddaButton) => void;
}
interface ILadda {
bind(target: HTMLElement, options?: ILaddaOptions): void;
bind(cssSelector: string, options?: ILaddaOptions): void;
create(button: Element): ILaddaButton;
stopAll(): void;
}
declare var Ladda: ILadda;
declare module "ladda" {
export = Ladda;
}
interface JQuery {
/**
* Creates a new instance of ladda for the selected button
*/
ladda(): JQuery;
/**
* The action controls or checks the state of the ladda button.
* Possible actions are 'start', 'stop', 'toggle', 'stopAll'
* Possible check 'isLoading'
*/
ladda(action: string): JQuery;
/**
* When the action is 'setProgress' you can pass a number between
* 0 and 1 for the options to represent the progress. For example .5 would be 50%
* When the action is 'bind' you can pass an object with a property
* called timeout with the timeout value in milliseconds.
* For example { timeout: 2000 }
*/
ladda(action: string, options: any): JQuery;
}
interface JQueryStatic {
ladda(action: string): JQuery;
}