diff options
Diffstat (limited to 'src/features/settings/settingThings/FakeRequireToggle.js')
-rw-r--r-- | src/features/settings/settingThings/FakeRequireToggle.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/features/settings/settingThings/FakeRequireToggle.js b/src/features/settings/settingThings/FakeRequireToggle.js new file mode 100644 index 0000000..41932f3 --- /dev/null +++ b/src/features/settings/settingThings/FakeRequireToggle.js @@ -0,0 +1,27 @@ + +class FakeRequireToggle{ + constructor(val){ + this.val = val + + this.thisToggleEvents = [] + + this.toggleObject = { + addEvent: (event)=>{ + this.thisToggleEvents.push(event) + } + } + } + + set(newVal){ + if(this.val === newVal) return + this.val = newVal + + this.thisToggleEvents.forEach(e=>e._trigger(this, [this.val])) + } + + getValue(){ + return this.val + } +} + +export default FakeRequireToggle
\ No newline at end of file |