MCPcopy Index your code
hub / github.com/bigskysoftware/_hyperscript / _bind

Function _bind

www/js/_hyperscript.esm.js:9907–9939  ·  view source on GitHub ↗
(left, right, target, feature, runtime2)

Source from the content-addressed store, hash-verified

9905 return typeof expr.set === "function";
9906}
9907function _bind(left, right, target, feature, runtime2) {
9908 var ctx = runtime2.makeContext(target, feature, target, null);
9909 var leftSide = _resolveSide(left, target, feature, runtime2, ctx);
9910 var rightSide = _resolveSide(right, target, feature, runtime2, ctx);
9911 var leftWritable = leftSide.element || _isAssignable(left);
9912 var rightWritable = rightSide.element || _isAssignable(right);
9913 if (!leftWritable && !rightWritable) {
9914 throw new Error("bind requires at least one writable side");
9915 }
9916 if (leftWritable) {
9917 runtime2.reactivity.createEffect(
9918 function() {
9919 return rightSide.read();
9920 },
9921 function(newValue) {
9922 leftSide.write(newValue);
9923 },
9924 { element: target }
9925 );
9926 }
9927 if (rightWritable) {
9928 runtime2.reactivity.createEffect(
9929 function() {
9930 return leftSide.read();
9931 },
9932 function(newValue) {
9933 rightSide.write(newValue);
9934 },
9935 { element: target }
9936 );
9937 }
9938 _setupFormReset(leftSide, rightSide, target, runtime2);
9939}
9940function _resolveSide(expr, target, feature, runtime2, ctx) {
9941 var value = expr.evaluate(ctx);
9942 if (value instanceof Element) {

Callers 1

installMethod · 0.70

Calls 5

_resolveSideFunction · 0.70
_isAssignableFunction · 0.70
_setupFormResetFunction · 0.70
makeContextMethod · 0.45
createEffectMethod · 0.45

Tested by

no test coverage detected