-
Notifications
You must be signed in to change notification settings - Fork 8
/
ng2-izitoast.js
171 lines (166 loc) · 4.09 KB
/
ng2-izitoast.js
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
import { Injectable, NgModule } from '@angular/core';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
class Ng2IzitoastService {
constructor() {
this.toastConfigQuestion = {
timeout: 20000,
close: false,
overlay: true,
toastOnce: true,
id: 'question',
zindex: 999,
title: 'Hey',
message: 'Are you sure about that?',
position: 'center',
buttons: [
['<button><b>YES</b></button>', function (instance, toast) {
instance.hide(toast, { transitionOut: 'fadeOut' }, 'button');
}, true],
['<button>NO</button>', function (instance, toast) {
instance.hide(toast, { transitionOut: 'fadeOut' }, 'button');
}]
],
onClosing: function (instance, toast, closedBy) {
console.info('Closing | closedBy: ' + closedBy);
},
onClosed: function (instance, toast, closedBy) {
console.info('Closed | closedBy: ' + closedBy);
}
};
}
/**
* @param {?} data
* @return {?}
*/
show(data) {
iziToast.show(data);
return data;
}
/**
* @param {?} data
* @return {?}
*/
info(data) {
iziToast.info(data);
return data;
}
/**
* @param {?} data
* @return {?}
*/
success(data) {
iziToast.success(data);
return data;
}
/**
* @param {?} data
* @return {?}
*/
warning(data) {
iziToast.warning(data);
return data;
}
/**
* @param {?} data
* @return {?}
*/
error(data) {
iziToast.error(data);
return data;
}
/**
* @param {?} data
* @return {?}
*/
question(data) {
let /** @type {?} */ iziToastConfig = Object.assign({}, this.toastConfigQuestion, data);
iziToast.question(iziToastConfig);
return iziToastConfig;
}
/**
* @param {?} iziToastClass
* @return {?}
*/
progress(iziToastClass) {
let /** @type {?} */ toast = document.querySelector(iziToastClass);
return {
reset: () => {
setTimeout(() => {
iziToast.progress(toast).reset();
}, 100);
},
pause: () => {
setTimeout(() => {
iziToast.progress(toast).pause();
}, 100);
},
resume: () => {
setTimeout(() => {
iziToast.progress(toast).resume();
}, 100);
},
start: () => {
setTimeout(() => {
iziToast.progress(toast).start();
}, 100);
}
};
}
/**
* @param {?} iziToastClass
* @param {?=} options
* @return {?}
*/
hide(iziToastClass, options = null) {
let /** @type {?} */ toast = document.querySelector(iziToastClass);
iziToast.hide(toast, options);
}
/**
* @return {?}
*/
destroy() {
iziToast.destroy();
}
/**
* @param {?} data
* @return {?}
*/
settings(data) {
iziToast.settings(data);
return data;
}
}
Ng2IzitoastService.decorators = [
{ type: Injectable },
];
/** @nocollapse */
Ng2IzitoastService.ctorParameters = () => [];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
class Ng2IziToastModule {
}
Ng2IziToastModule.decorators = [
{ type: NgModule, args: [{
providers: [Ng2IzitoastService]
},] },
];
/** @nocollapse */
Ng2IziToastModule.ctorParameters = () => [];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Generated bundle index. Do not edit.
*/
export { Ng2IzitoastService, Ng2IziToastModule };
//# sourceMappingURL=ng2-izitoast.js.map