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

Method initialize

www/js/_hyperscript-max.js:2980–2998  ·  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

2978 * left-side-wins initialization in bind.
2979 */
2980 initialize() {
2981 var reactivity2 = this._reactivity;
2982 var prev = reactivity2._currentEffect;
2983 reactivity2._currentEffect = this;
2984 try {
2985 this._lastValue = this.expression();
2986 } catch (e) {
2987 console.error("Error in reactive expression:", e);
2988 }
2989 reactivity2._currentEffect = prev;
2990 reactivity2._subscribeEffect(this);
2991 if (this._lastValue != null) {
2992 try {
2993 this.handler(this._lastValue);
2994 } catch (e) {
2995 console.error("Error in reactive handler:", e);
2996 }
2997 }
2998 }
2999 /**
3000 * Re-evaluate expression with dependency tracking, compare with last
3001 * 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