-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlazytoast.js
45 lines (37 loc) · 1.1 KB
/
lazytoast.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
module.exports = function (mpcp) {
return {
info: function (msg, title, timeout, addHistory) {
if (!title) title = 'Info'
if (!timeout) timeout = 5000
if (addHistory) mpcp.history.add(msg, 'info')
toastr.info(msg, title, {
closeButton: true,
positionClass: 'toast-bottom-left',
preventDuplicates: true,
timeOut: timeout
})
},
error: function (msg, title, timeout, addHistory) {
if (!title) title = 'Error'
if (addHistory) mpcp.history.add(msg, 'danger')
toastr.error(msg, title, {
closeButton: true,
positionClass: 'toast-bottom-left',
preventDuplicates: true,
timeOut: '-1',
extendedTimeOut: '-1'
})
},
warning: function (msg, title, timeout, addHistory) {
if (!title) title = 'Warning'
if (!timeout) timeout = 5000
if (addHistory) mpcp.history.add(msg, 'warning')
toastr.warning(msg, title, {
closeButton: true,
positionClass: 'toast-bottom-left',
preventDuplicates: false,
timeOut: timeout
})
}
}
}