Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Commit

Permalink
feat: added CommandMap.unregister method
Browse files Browse the repository at this point in the history
  • Loading branch information
harryitz committed May 7, 2024
1 parent b78ebf1 commit b200261
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/command/CommandMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ export class CommandMap {
this.knownCommands[commandName] = command;
}

/**
* @param {Command} command
*/
unregister(command) {
Object.keys(this.knownCommands).forEach(key => {
if (this.knownCommands[key] === command) {
delete this.knownCommands[key];
}
});
}

registerAllForClient() {
const commands = Object.values(this.getCommands()).map(cmd => cmd.toJSON());

Expand Down
1 change: 0 additions & 1 deletion src/scheduler/Task.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { TaskHandler } from "./TaskHandler.js";
export class Task {

id = -1;
taskHandler;

constructor() {}

Expand Down

0 comments on commit b200261

Please sign in to comment.