forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 1
/
toastr.d.ts
207 lines (201 loc) · 4.23 KB
/
toastr.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
// Type definitions for Toastr 2.0.1
// Project: https://github.com/CodeSeven/toastr
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
interface ToastrOptions {
/**
* Optionally override the animation easing to show or hide the toasts. Default is swing. swing and linear are built into jQuery.
*/
showEasing?: string;
/**
* Optionally override the animation easing to show or hide the toasts. Default is swing. swing and linear are built into jQuery.
*/
hideEasing?: string;
/**
* Use the jQuery show/hide method of your choice. These default to fadeIn/fadeOut. The methods fadeIn/fadeOut, slideDown/slideUp, and show/hide are built into jQuery.
*/
showMethod?: string;
/**
* Use the jQuery show/hide method of your choice. These default to fadeIn/fadeOut. The methods fadeIn/fadeOut, slideDown/slideUp, and show/hide are built into jQuery.
*/
hideMethod?: string;
/**
* Should a close button be shown
*/
closeButton?: boolean;
/**
* Html for the close button
*/
closeHtml?: string;
/**
* Should clicking on toast dismiss it?
*/
tapToDismiss?: boolean;
/**
* CSS class the toast element will be given
*/
toastClass?: string;
/**
* Id toast container will be given
*/
containerId?: string;
/**
* Should debug details be outputted to the console
*/
debug?: boolean;
/**
* Time in milliseconds the toast should take to show
*/
showDuration?: number;
/**
* onShown function callback
**/
onShown?: () => void;
/**
* Time in milliseconds the toast should take to hide
*/
hideDuration?: number;
/**
* onHidden function callback
**/
onHidden?: () => void;
/**
* Time in milliseconds the toast should be displayed after mouse over
*/
extendedTimeOut?: number;
iconClasses?: {
/**
* Icon to use on error toasts
*/
error: string;
/**
* Icon to use on info toasts
*/
info: string;
/**
* Icon to use on success toasts
*/
success: string;
/**
* Icon to use on warning toasts
*/
warning: string;
};
/**
* Icon to use for toast
*/
iconClass?: string;
/**
* Where toast should be displayed
*/
positionClass?: string;
/**
* Where toast should be displayed - background
*/
backgroundpositionClass?: string;
/**
* Time in milliseconds that the toast should be displayed
*/
timeOut?: number;
/**
* CSS class the title element will be given
*/
titleClass?: string;
/**
* CSS class the message element will be given
*/
messageClass?: string;
/**
* Set newest toast to appear on top
**/
newestOnTop?: boolean;
/**
* The element to put the toastr container
**/
target?: string;
/**
* Rather than having identical toasts stack, set the preventDuplicates property to true. Duplicates are matched to the previous toast based on their message content.
*/
preventDuplicates?: boolean;
/**
* Visually indicates how long before a toast expires.
*/
progressBar?: boolean;
/**
* Function to execute on toast click
*/
onclick?: () => void;
/**
* Set if toastr should parse containing html
**/
allowHtml?: boolean;
}
interface ToastrDisplayMethod {
/**
* Create a toast
*
* @param message Message to display in toast
*/
(message: string): JQuery;
/**
* Create a toast
*
* @param message Message to display in toast
* @param title Title to display on toast
*/
(message: string, title: string): JQuery;
/**
* Create a toast
*
* @param message Message to display in toast
* @param title Title to display on toast
* @param overrides Option values for toast
*/
(message: string, title: string, overrides: ToastrOptions): JQuery;
}
interface Toastr {
/**
* Clear toasts
*/
clear: {
/**
* Clear all toasts
*/
(): void;
/**
* Clear specific toast
*
* @param toast Toast to clear
*/
(toast: JQuery): void;
};
/**
* Create an error toast
*/
error: ToastrDisplayMethod;
/**
* Create an info toast
*/
info: ToastrDisplayMethod;
/**
* Create an options object
*/
options: ToastrOptions;
/**
* Create a success toast
*/
success: ToastrDisplayMethod;
/**
* Create a warning toast
*/
warning: ToastrDisplayMethod;
/**
* Get toastr version
*/
version: string;
}
declare var toastr: Toastr;
declare module "toastr" {
export = toastr;
}