aboutsummaryrefslogtreecommitdiff
path: root/resources/vue/components/courseware/plugin-manager.js
blob: 26ee566f8d718f7169c83e9966cba5717e9c4ae1 (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
class PluginManager {
    constructor() {
        this.blocks = [];
        this.containers = [];
    }

    addBlock(name, block) {
        this.blocks[name] = block;
    }
    addContainer(name, container) {
        this.containers[name] = container;
    }

    registerComponentsLocally(component) {
        for (const [name, block] of Object.entries(this.blocks)) {
            component.$options.components[name] = block;
        }
        for (const [name, container] of Object.entries(this.containers)) {
            component.$options.components[name] = container;
        }
    }
}

export default PluginManager;