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