-
Notifications
You must be signed in to change notification settings - Fork 29
/
log.js
58 lines (53 loc) · 1.18 KB
/
log.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
module.exports = {
info () {
notie.alert({
text: Array.prototype.join.call(arguments, ' '),
type: 'info',
time: 3
})
console.log.apply(console, arguments)
},
error (e) {
if (e.stack) {
console.error(e.stack)
notie.alert({
text: 'Something wrong has occurred, see the console for the complete error.',
type: 'error',
time: 3
})
return
}
notie.alert({
text: Array.prototype.join.call(arguments, ' '),
type: 'error',
time: 5
})
console.error.apply(console, arguments)
},
success () {
notie.alert({
text: Array.prototype.join.call(arguments, ' '),
type: 'success',
time: 3
})
},
confirm (text, confirmed, cancelled) {
notie.confirm({text}, confirmed, cancelled)
}
}
const notie = {
alert: function (params) {
if (window.notie) {
window.notie.alert(params)
} else {
setTimeout(() => notie.alert(params), 1000)
}
},
confirm: function () {
if (window.notie) {
window.notie.confirm.apply(window.notie, arguments)
} else {
setTimeout(() => notie.confirm.apply(notie, arguments), 1000)
}
}
}