-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
68 lines (62 loc) · 1.61 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
61
62
63
64
65
66
67
68
const TapSound = require('mofron-event-tapsound');
const comutl = mofron.util.common;
/**
* @file mofron-event-buttonsound/index.js
* @brief click sound event for mofron
* @license MIT
*/
module.exports = class extends TapSound {
/**
* initialize event
*
* @param (mixed) short-form parameter
* key-value: event config
* @short
* @type private
*/
constructor (prm) {
try {
super();
this.modname('SoundJump');
this.confmng().add('url', { type:'string' });
delete this.listener()[0];
let tap_evt = (c1,c2,c3) => {
try {
let mute_flg = localStorage.getItem('mute');
if (true !== mute_flg) {
c3.src().play();
}
/* page jump */
setTimeout(() => { window.location.href = c3.url(); }, 500);
} catch (e) {
console.error(e.stack);
throw e;
}
};
this.listener(tap_evt,this);
if (undefined !== prm) {
this.config(prm);
}
} catch (e) {
console.error(e.stack);
throw e;
}
}
url (prm) {
try {
return this.confmng('url',prm);
} catch (e) {
console.error(e.stack);
throw e;
}
}
audio (prm) {
try {
return this.src(prm);
} catch (e) {
console.error(e.stack);
throw e;
}
}
}
/* end of file */