@surface/custom-element
Version:
Provides support of directives and data binding on custom elements.
24 lines (23 loc) • 745 B
JavaScript
import Block from "../block.js";
import InjectStatement from "../statements/inject-statement.js";
export default function injectionFactory(key, value, observables, factory) {
return () => {
const block = new Block();
const activator = (parent, host, scope, directives) => {
parent.insertBefore(block.start, block.end);
const context = {
block,
directives,
factory,
host,
key,
observables,
parent,
scope,
value,
};
return new InjectStatement(context);
};
return [block.end, activator];
};
}