UNPKG

1.38 kBTypeScriptView Raw
1import BaseComponent, { GetInstanceFactory, GetOrCreateInstanceFactory } from "./base-component";
2
3declare class Alert extends BaseComponent {
4 static NAME: "alert";
5 static jQueryInterface: Alert.jQueryInterface;
6
7 /**
8 * Static method which allows you to get the alert instance associated to a
9 * DOM element, you can use it like this: getInstance(alert)
10 */
11 static getInstance: GetInstanceFactory<Alert>;
12
13 /**
14 * Static method which returns an alert instance associated to a DOM element
15 * or create a new one in case it wasn't initialised.
16 * You can use it like this: bootstrap.Alert.getOrCreateInstance(element)
17 */
18 static getOrCreateInstance: GetOrCreateInstanceFactory<Alert>;
19
20 /**
21 * Closes an alert by removing it from the DOM. If the .fade and .show
22 * classes are present on the element, the alert will fade out before it
23 * is removed.
24 */
25 close(): void;
26}
27
28declare namespace Alert {
29 enum Events {
30 /**
31 * Fires immediately when the close instance method is called.
32 */
33 close = "close.bs.alert",
34
35 /**
36 * Fired when the alert has been closed and CSS transitions have
37 * completed.
38 */
39 closed = "closed.bs.alert",
40 }
41
42 type jQueryInterface = (config?: "close" | "dispose") => JQuery;
43}
44
45export default Alert;