diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2022-07-27 00:30:42 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2022-07-27 00:30:42 -0400 |
commit | d0ec435399ff3308be1b79ad67e37321b9a97b8e (patch) | |
tree | 9298f875c7cb6328294427d8e543c9024a08798d /scripts/gui/input.js | |
parent | a97fcacb0ce4d2f30fbe989ec1f62f6bd95c7e9a (diff) |
[chat] Use an object instead of a list
Diffstat (limited to 'scripts/gui/input.js')
-rw-r--r-- | scripts/gui/input.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/scripts/gui/input.js b/scripts/gui/input.js index 032d168..da19d95 100644 --- a/scripts/gui/input.js +++ b/scripts/gui/input.js @@ -289,14 +289,24 @@ class MakeInput { } // Mostly fixed now -class Settings { +class Settings extends EventTarget { constructor (template = {}) { + super(); this.settings = Settings.genSettings(template); + this.applyEvents(template); this.wrappers = {}; } + applyEvents (template) { + for(let key in template) + { + if(typeof MakeInput[template[key].type+"Input"] != null) + this.settings[key].el.onchange = (function () {this.dispatchEvent(new CustomEvent("change"));}).bind(this); + } + } + static genSettings (template) { let out = {}; |