-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
60 lines (57 loc) · 1.46 KB
/
index.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
const Confirm = require('mofron-comp-confirm');
const ConfArg = mofron.class.ConfArg;
let cfm_event = [() => { console.log("cfm event test"); },undefined];
let confirm = new Confirm({ clickEvent: (c1,c2,c3) => { cfm_event[0](c1,c2,cfm_event[1]); } });
module.exports = {
show: (msg,evt) => {
try {
confirm.text(msg);
/* set callback for parameter */
if ('function' === typeof evt) {
cfm_event[0] = evt;
} else if ((true === Array.isArray(evt)) && ('function' === typeof evt[0])) {
cfm_event = evt;
}
let r_chd = mofron.root[0].child();
let is_exist = false
for (let ridx in r_chd) {
if (r_chd[ridx].id() === confirm.id()) {
is_exist = true;
break;
}
}
if (false === is_exist) {
mofron.root[0].child(confirm);
}
confirm.visible(true);
} catch (e) {
console.error(e.stack);
throw e;
}
},
size: (wid,hei) => {
try {
confirm.width(wid);
confirm.height(hei);
} catch (e) {
console.error(e.stack);
throw e;
}
},
okcancel: (ok, can) => {
try {
confirm.okcancel(ok,can);
} catch (e) {
console.error(e.stack);
throw e;
}
},
config: (cnf) => {
try {
confirm.config(cnf);
} catch (e) {
console.error(e.stack);
throw e;
}
}
};