-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Copy pathindex.d.ts
112 lines (97 loc) · 2.94 KB
/
index.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
declare module "noty" {
type NotyType = 'alert' | 'success' | 'warning' | 'error' | 'info' | 'information';
type NotyTheme = 'mint' | 'sunset' | 'relax' | 'metroui' | 'bootstrap-v3' | 'bootstrap-v4' | 'semanticui' | 'nest';
type NotyLayout = 'top' | 'topLeft' | 'topCenter' | 'topRight' | 'center' | 'centerLeft' | 'centerRight' | 'bottom' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
type NotyEvent = 'beforeShow' | 'onShow' | 'afterShow' | 'onClose' | 'afterClose' | 'onHover' | 'onTemplate';
export interface NotyButton {
new(text: string, classNames: string, cb: Function, attributes: any) : NotyButton
}
export interface NotyOptions {
type?: NotyType;
layout?: NotyLayout;
theme?: NotyTheme;
text?: string;
timeout?: false | number;
progressBar?: boolean;
closeWith?: ('click' | 'button')[];
animation?: {
open?: string | null | Function,
close?: string | null | Function
};
id?: false | string;
force?: boolean;
killer?: boolean | string;
queue?: string;
container?: false | string;
buttons?: NotyButton[],
callbacks?: {
beforeShow?: () => void,
onShow?: () => void,
afterShow?: () => void,
onClose?: () => void,
afterClose?: () => void,
onHover?: () => void,
onTemplate?: () => void
};
sounds?: {
sources?: string[],
volume?: number,
conditions?: string[]
};
docTitle?: {
conditions?: string[]
};
modal?: boolean,
}
export default class Noty {
constructor(options?: NotyOptions);
/**
* Show a NOTY
*/
show: () => void;
/**
* Close a NOTY
*/
close: () => void;
/**
* Notification text updater. Important: .noty_body class is required for setText API method.
*/
setText: (text: string, overrideConstructorOption?: true) => void;
/**
* Notification type updater
*/
setType: (type: NotyType, overrideConstructorOption?: true) => void;
/**
* Notification theme updater
*/
setTheme: (theme: NotyTheme, overrideConstructorOption?: true) => void;
/**
* false (clears timeout) or integer (clears timer, starts for given value)
*/
setTimeout: (option: false | number) => void; //
/**
* Clears the timeout
*/
stop: () => void;
/**
* Restarts the timeout
*/
resume: () => void;
/**
* Register event handlers for Noty outside of constructior options.
* Important: You need to call on() methods before the show() method.
*/
on: (eventName: NotyEvent, callback: Function) => void;
/**
* Without queue name: Closes all notifications.
* With queue name: Closes all notifications for the named queue
*/
static closeAll: (queueName?: string) => void;
/**
* Without queue name: Sets the maxVisible notification count for global queue.
* With parameter: Sets the maxVisible notification count for the named queue;
*/
static setMaxVisible: (max: number, queueName?: string) => void;
static button: (text: string, classNames: string, cb: Function, attributes?: any) => NotyButton;
}
}