diff options
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 = {}; |