-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlertify.ts
More file actions
67 lines (53 loc) · 1.75 KB
/
Alertify.ts
File metadata and controls
67 lines (53 loc) · 1.75 KB
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
module MOA.UI {
export class Alertify {
private static _instance: Alertify = null;
constructor() {
if (Alertify._instance) {
throw new Error("Error: Instantiation failed: Use Alertify.getInstance() instead of new.");
}
Alertify._instance = this;
this.init();
}
public static getInstance(): Alertify {
if (Alertify._instance === null) {
Alertify._instance = new Alertify();
}
return Alertify._instance;
}
alert(value: string) {
alertify.alert(value);
}
confirm(value: string, callback?: any) {
alertify.confirm(value, callback);
}
confirmWithAction(value: string, okCallBack: ()=> any) {
alertify.confirm(value, (ok) => {
if (ok) {
okCallBack();
}
});
}
success(message: string) {
alertify.success(message);
}
error(message: string) {
alertify.error(message);
}
set(options: Options) {
alertify.set(options);
}
private init() {
alertify.set(
{
labels: {
ok: "Ok",
cancel: "Avbryt"
}
}
);
alertify.init();
//Måste lägga denna på ett annat ställe då den hamnar fel när progressbaren vid sparning körs
$("#body").append($('#alertify-cover').detach());
}
}
}