Добавил сайт
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
class Dispatcher {
|
||||
constructor() {
|
||||
this.commands = {};
|
||||
}
|
||||
|
||||
AddCommand(command_name, command) {
|
||||
this.commands[command_name] = command;
|
||||
}
|
||||
|
||||
Dispatch(response) {
|
||||
if (response["status"] != "ok") {
|
||||
alert(`Возникла ошибка. Пожалуйста, сообщите о ней разработчикам: ${response["error_message"]}`);
|
||||
return;
|
||||
}
|
||||
|
||||
let command = response["command"];
|
||||
console.log("dispatching " + command);
|
||||
this.commands[command].ProcessResponse(response);
|
||||
}
|
||||
|
||||
commands;
|
||||
}
|
||||
Reference in New Issue
Block a user