-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtwtoast.js
50 lines (47 loc) · 1.41 KB
/
twtoast.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
const config = require("./twtoast.config.js");
const Toast = require("./classes/Toast");
const Snackbar = require("./classes/Snackbar");
if (config.methods) {
config.methods.forEach((method) => {
eval(
"Toast.prototype." +
Object.keys(method)[0] +
" = " +
Object.values(method)
);
eval(
"Snackbar.prototype." +
Object.keys(method)[0] +
" = " +
Object.values(method)
);
});
}
module.exports = {
toast: () => {
return new Toast(
config.color ? config.color : "blue-500",
config.icon ? config.icon : "fas fa-bell",
config.duration ? config.duration : 3000,
config.positionX ? config.positionX : "center",
config.positionY ? config.positionY : "top",
config.fontColor ? config.fontColor : "grey",
config.fontTone ? config.fontTone : 100,
config.shape ? config.shape : "square",
config.speed ? config.speed : 500
);
},
snackbar: () => {
return new Snackbar(
config.color ? config.color : "blue-500",
config.icon ? config.icon : "fas fa-bell",
config.duration ? config.duration : 3000,
config.positionX ? config.positionX : "center",
config.positionY ? config.positionY : "top",
config.fontColor ? config.fontColor : "grey",
config.fontTone ? config.fontTone : 100,
config.shape ? config.shape : "square",
config.speed ? config.speed : 500
);
},
};