summaryrefslogtreecommitdiff
path: root/WebInterface/src/js/modules/networking/commands/_command.js
diff options
context:
space:
mode:
Diffstat (limited to 'WebInterface/src/js/modules/networking/commands/_command.js')
-rw-r--r--WebInterface/src/js/modules/networking/commands/_command.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/WebInterface/src/js/modules/networking/commands/_command.js b/WebInterface/src/js/modules/networking/commands/_command.js
new file mode 100644
index 0000000..46a1a14
--- /dev/null
+++ b/WebInterface/src/js/modules/networking/commands/_command.js
@@ -0,0 +1,28 @@
+/**
+ * Parent Command class which all commands inherit from
+ */
+export default class Command {
+ /**
+ * Constructs basic command object
+ * @param {Interface} iface Interface to communicate over
+ */
+ constructor(iface) {
+ this.iface = iface;
+ }
+
+ /**
+ * Registers public command names to interface
+ * @param {String} name Name to register under
+ * @param {...String} commandNames Names of public commands
+ */
+ registerPublic(name, ...commandNames) {
+ this.iface.addObject(this, name, ['destroy'].concat(commandNames));
+ }
+
+ /**
+ * Removes from iface
+ */
+ destroy() {
+ this.iface.removeObject(this);
+ }
+}