mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 00:31:20 -08:00
Add more valid
This commit is contained in:
1 parent
5f45ad112f
commit
d919471838
7 files changed
+31
-11
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import { errorHandle } from './utils';
|
||||
|
||||
export default class Hotkey {
|
||||
constructor(art) {
|
||||
this.keys = {};
|
||||
@@ -55,6 +57,8 @@ export default class Hotkey {
|
||||
}
|
||||
|
||||
add(key, event) {
|
||||
errorHandle(typeof key === 'number', 'The Hotkey.add() first parameter is not a number');
|
||||
errorHandle(typeof event === 'function', 'The Hotkey.add() second parameter is not a function');
|
||||
if (this.keys[key]) {
|
||||
this.keys[key].push(event);
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user