File size: 704 Bytes
bc20498 |
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 |
export function builderActions(node, params) {
const unsubs = [];
params.builders.forEach((builder) => {
const act = builder.action(node);
if (act) {
unsubs.push(act);
}
});
return {
destroy: () => {
unsubs.forEach((unsub) => {
if (unsub.destroy) {
unsub.destroy();
}
});
},
};
}
export function getAttrs(builders) {
const attrs = {};
builders.forEach((builder) => {
Object.keys(builder).forEach((key) => {
if (key !== "action") {
attrs[key] = builder[key];
}
});
});
return attrs;
}
|