mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
23 lines
363 B
JavaScript
23 lines
363 B
JavaScript
const commands = {};
|
|
|
|
class CommandRegistry {
|
|
register(cmds) {
|
|
if (cmds) {
|
|
for (const command in cmds) {
|
|
if (command) {
|
|
commands[command] = cmds[command];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
getCommand(cmd) {
|
|
return commands[cmd] !== undefined;
|
|
}
|
|
|
|
exec(cmd, e) {
|
|
commands[cmd](e);
|
|
}
|
|
}
|
|
|
|
export default new CommandRegistry();
|