JS: Move JavaScript to commandbar subdirectory
This commit is contained in:
parent
ccd2a25920
commit
563693fb79
5 changed files with 0 additions and 0 deletions
32
assets/commandbar/js/setHandler.js
Normal file
32
assets/commandbar/js/setHandler.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
class SetEvent extends Event {
|
||||
#option;
|
||||
#newValue;
|
||||
|
||||
constructor(option, newValue) {
|
||||
super("setOption")
|
||||
this.#option = option;
|
||||
this.#newValue = newValue;
|
||||
}
|
||||
|
||||
get option() {
|
||||
return this.#option;
|
||||
}
|
||||
|
||||
get newValue() {
|
||||
return this.#newValue;
|
||||
}
|
||||
}
|
||||
|
||||
export class SetOptionHandler {
|
||||
get name() {
|
||||
return "set";
|
||||
}
|
||||
|
||||
execute(command, commandBar) {
|
||||
for (const param of command.parameters) {
|
||||
const setEvent = new SetEvent(param.name.valueOf(), param.value.valueOf());
|
||||
commandBar.dispatchEvent(setEvent);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue