mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-22 19:14:52 +01:00
make disposeTracked suitable to reassign member
This commit is contained in:
parent
d0f09c5334
commit
54502c906f
@ -25,12 +25,16 @@ export class Disposables {
|
||||
}
|
||||
|
||||
disposeTracked(value) {
|
||||
if (value === undefined || value === null) {
|
||||
return null;
|
||||
}
|
||||
const idx = this._disposables.indexOf(value);
|
||||
if (idx !== -1) {
|
||||
const [foundValue] = this._disposables.splice(idx, 1);
|
||||
disposeValue(foundValue);
|
||||
return true;
|
||||
} else {
|
||||
console.warn("disposable not found, did it leak?", value);
|
||||
}
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user