also make an observable version of a retained value
This commit is contained in:
parent
36f54420cf
commit
3143f2a791
1 changed files with 12 additions and 0 deletions
|
@ -94,6 +94,18 @@ export class ObservableValue extends BaseObservableValue {
|
|||
}
|
||||
}
|
||||
|
||||
export class RetainedObservableValue extends ObservableValue {
|
||||
constructor(initialValue, freeCallback) {
|
||||
super(initialValue);
|
||||
this._freeCallback = freeCallback;
|
||||
}
|
||||
|
||||
onUnsubscribeLast() {
|
||||
super.onUnsubscribeLast();
|
||||
this._freeCallback();
|
||||
}
|
||||
}
|
||||
|
||||
export function tests() {
|
||||
return {
|
||||
"set emits an update": assert => {
|
||||
|
|
Reference in a new issue