73
74
constructor(
76
>
private readonly event: Event<TArgs>,
77
>
public readonly _getValue: (args: TArgs | undefined) => T,
78
>
private readonly _getTransaction: () => ITransaction | undefined,
79
>
private readonly _equalityComparator: EqualityComparer<T>,
80
>
debugLocation: DebugLocation
81
>
) {
82
>
super(debugLocation);
83
>
}
84
>
85
>
private getDebugName(): string | undefined {
86
return this._debugNameData.getDebugName(this);
87
}
89
>
public get debugName(): string {
90
const name = this.getDebugName();
91
return 'From Event' + (name ? `: ${name}` : '');
92
}
94
>
protected override onFirstObserverAdded(): void {
95
this._subscription = this.event(this.handleEvent);
96
}
98
>
private readonly handleEvent = (args: TArgs | undefined) => {
99
const newValue = this._getValue(args);
100
const oldValue = this._value;