File size: 618 Bytes
30c32c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
28
29
class ModalManager {
    constructor (runtime) {
        this.runtime = runtime;
        this.modals = {};
        this._updateId = 0;
    }
    updateModalComponents () {
        this._updateId++;
        if (this._updateId > 1000000) {
            this._updateId = 0;
        }
    }

    createModal (id, config) {
        this.modals[id] = {
            ...config,
            id
        };
        this.updateModalComponents();
    }
    deleteModal (id) {
        if (id in this.modals) {
            delete this.modals[id];
        }
        this.updateModalComponents();
    }
}

module.exports = ModalManager;