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

Method initialize

tools/common/_hyperscript.iife.js:2930–2948  ·  view source on GitHub ↗

* First evaluation: track deps, subscribe, call handler if non-null. * Both undefined and null are treated as "no value yet" to support * left-side-wins initialization in bind.

()

Source from the content-addressed store, hash-verified

2928 * left-side-wins initialization in bind.
2929 */
2930 initialize() {
2931 var reactivity2 = this._reactivity;
2932 var prev = reactivity2._currentEffect;
2933 reactivity2._currentEffect = this;
2934 try {
2935 this._lastValue = this.expression();
2936 } catch (e) {
2937 console.error("Error in reactive expression:", e);
2938 }
2939 reactivity2._currentEffect = prev;
2940 reactivity2._subscribeEffect(this);
2941 if (this._lastValue != null) {
2942 try {
2943 this.handler(this._lastValue);
2944 } catch (e) {
2945 console.error("Error in reactive handler:", e);
2946 }
2947 }
2948 }
2949 /**
2950 * Re-evaluate expression with dependency tracking, compare with last
2951 * value, and call handler if changed. Returns false if circular

Callers

nothing calls this directly

Calls 2

_subscribeEffectMethod · 0.45
handlerMethod · 0.45

Tested by

no test coverage detected