aboutsummaryrefslogtreecommitdiff
path: root/features/settings/settingThings/FakeRequireToggle.js
blob: 41932f303d8f6ff5bbb6ecb02476a5e7b3b60a5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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