* 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.
()
| 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 |
nothing calls this directly
no test coverage detected