blob: 9796bb449390621a607c87cc1814a8e4721f15de (
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
28
29
30
|
import ExtensionBase from './base.vue';
// Holds all the currently registered extensions
export const extensions = [];
export const registerExtension = (extension) => {
// Pushes into the extenions array a dynamically created Vue component
// that gets exteneded from `base.vue`
extensions.push({
extends: ExtensionBase,
name: extension.name,
props: extension.props,
computed: {
...Object.keys(extension.computed).reduce(
(acc, computedKey) => ({
...acc,
// Making the computed property a method allows us to pass in arguments
// this allows for each computed property to recieve some data
[computedKey]() {
return extension.computed[computedKey];
},
}),
{},
),
},
methods: {
...extension.methods,
},
});
};
|