You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
465 B
JavaScript
20 lines
465 B
JavaScript
|
1 year ago
|
export default {
|
||
|
|
a: {}, canDoFunction(e = {}) {
|
||
|
|
if (!this.a[e.key]) {
|
||
|
|
this.lockKey(e.key);
|
||
|
|
e.success && e.success();
|
||
|
|
if (e.time) {
|
||
|
|
setTimeout(() => {
|
||
|
|
this.releaseKey(e.key)
|
||
|
|
}, e.time)
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
e.fail && e.fail()
|
||
|
|
}
|
||
|
|
}, releaseKey(key) {
|
||
|
|
delete this.a[key]
|
||
|
|
}, lockKey(key) {
|
||
|
|
this.a[key] = true
|
||
|
|
}
|
||
|
|
}
|