UNPKG

stencil-quantum

Version:

Experience the quantum realm of stencil.

32 lines (26 loc) 944 B
import { h } from "@stencil/core"; export function QuantumConsume(props, children) { return h("quantum-consumer", { bind: props.bind, onUpdate: e => props.onUpdate(e.detail.value, e.detail.provider) }, children); } export function QuantumProvide(props, children) { return h("quantum-provider", { bind: props.bind, onUpdate: e => { var _a; return (_a = props.onUpdate) === null || _a === void 0 ? void 0 : _a.call(props, e.detail.value, e.detail.provider); }, value: props.value }, children); } /* const test = new Entanglement({ test: qt<boolean>() }); function testJSX() { return <Consumer bind={test.get("test")} onValue={(value, provider) => {provider.provide(!value)}}></Consumer> } function testFn() { return <div> {Consumer({bind: test.get("test"), onValue: value => {}})} </div> } type B = QuantumKey<boolean, typeof test>; type C = B["config"]; type N = B["name"]; type T = ResolveQuantumKey<B, C>; */