UNPKG

@surface/custom-element

Version:

Provides support of directives and data binding on custom elements.

22 lines (21 loc) 673 B
/* eslint-disable sort-keys */ import Block from "../block.js"; import ChoiceStatement from "../statements/choice-statement.js"; export default function choiceFactory(branches) { return () => { const block = new Block(); const activate = (parent, host, scope, directives) => { parent.insertBefore(block.start, block.end); const context = { parent, host, scope, block, branches, directives, }; return new ChoiceStatement(context); }; return [block.end, activate]; }; }