mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 19:45:05 +01:00
Use undefined instead of null
This commit is contained in:
parent
1beb153f21
commit
5a0c06473c
@ -15,8 +15,8 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export class Lock {
|
export class Lock {
|
||||||
private _promise: Promise<void> | null = null;
|
private _promise?: Promise<void>;
|
||||||
private _resolve: (() => void) | null = null;
|
private _resolve?: (() => void);
|
||||||
|
|
||||||
tryTake(): boolean {
|
tryTake(): boolean {
|
||||||
if (!this._promise) {
|
if (!this._promise) {
|
||||||
@ -40,14 +40,14 @@ export class Lock {
|
|||||||
|
|
||||||
release(): void {
|
release(): void {
|
||||||
if (this._resolve) {
|
if (this._resolve) {
|
||||||
this._promise = null;
|
this._promise = undefined;
|
||||||
const resolve = this._resolve;
|
const resolve = this._resolve;
|
||||||
this._resolve = null;
|
this._resolve = undefined;
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
released(): Promise<void> | null {
|
released(): Promise<void> | undefined {
|
||||||
return this._promise;
|
return this._promise;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user