diff --git a/src/observable/ObservableValue.ts b/src/observable/ObservableValue.ts index ad0a226d..dab8fb52 100644 --- a/src/observable/ObservableValue.ts +++ b/src/observable/ObservableValue.ts @@ -201,7 +201,7 @@ export function tests() { "waitFor promise resolves on matching update": async assert => { const a = new ObservableValue(5); const handle = a.waitFor(v => v === 6); - Promise.resolve().then(() => { + await Promise.resolve().then(() => { a.set(6); }); await handle.promise; @@ -210,7 +210,7 @@ export function tests() { "waitFor promise rejects when disposed": async assert => { const a = new ObservableValue(0); const handle = a.waitFor(() => false); - Promise.resolve().then(() => { + await Promise.resolve().then(() => { handle.dispose(); }); await assert.rejects(handle.promise, AbortError); @@ -244,5 +244,5 @@ export function tests() { count.set(5); assert.deepEqual(updates, [0, 5]); } - } + }; } diff --git a/src/observable/list/AsyncMappedList.ts b/src/observable/list/AsyncMappedList.ts index 0a919cdc..53edde21 100644 --- a/src/observable/list/AsyncMappedList.ts +++ b/src/observable/list/AsyncMappedList.ts @@ -16,13 +16,13 @@ limitations under the License. */ import {IListObserver} from "./BaseObservableList"; -import {BaseMappedList, Mapper, Updater, runAdd, runUpdate, runRemove, runMove, runReset} from "./BaseMappedList"; +import {BaseMappedList, runAdd, runUpdate, runRemove, runMove, runReset} from "./BaseMappedList"; export class AsyncMappedList extends BaseMappedList> implements IListObserver { private _eventQueue: AsyncEvent[] | null = null; private _flushing: boolean = false; - onSubscribeFirst(): void { + async onSubscribeFirst(): Promise { this._sourceUnsubscribe = this._sourceList.subscribe(this); this._eventQueue = []; this._mappedValues = []; @@ -31,7 +31,7 @@ export class AsyncMappedList extends BaseMappedList> impleme this._eventQueue.push(new AddEvent(idx, item)); idx += 1; } - this._flush(); + await this._flush(); } async _flush(): Promise { @@ -49,38 +49,38 @@ export class AsyncMappedList extends BaseMappedList> impleme } } - onReset(): void { + async onReset(): Promise { if (this._eventQueue) { this._eventQueue.push(new ResetEvent()); - this._flush(); + await this._flush(); } } - onAdd(index: number, value: F): void { + async onAdd(index: number, value: F): Promise { if (this._eventQueue) { this._eventQueue.push(new AddEvent(index, value)); - this._flush(); + await this._flush(); } } - onUpdate(index: number, value: F, params: any): void { + async onUpdate(index: number, value: F, params: any): Promise { if (this._eventQueue) { this._eventQueue.push(new UpdateEvent(index, value, params)); - this._flush(); + await this._flush(); } } - onRemove(index: number): void { + async onRemove(index: number): Promise { if (this._eventQueue) { this._eventQueue.push(new RemoveEvent(index)); - this._flush(); + await this._flush(); } } - onMove(fromIdx: number, toIdx: number): void { + async onMove(fromIdx: number, toIdx: number): Promise { if (this._eventQueue) { this._eventQueue.push(new MoveEvent(fromIdx, toIdx)); - this._flush(); + await this._flush(); } } @@ -150,7 +150,7 @@ export function tests() { mapper.subscribe(observer); source.append(2); // will sleep this amount, so second append would take less time source.append(1); - source.update(0, 7, "lucky seven") + source.update(0, 7, "lucky seven"); source.remove(0); { const {type, index, value} = await observer.next(); @@ -182,5 +182,5 @@ export function tests() { assert.equal(value.n, 49); } } - } + }; } diff --git a/src/observable/list/ConcatList.ts b/src/observable/list/ConcatList.ts index 5822468a..8ef7326c 100644 --- a/src/observable/list/ConcatList.ts +++ b/src/observable/list/ConcatList.ts @@ -47,7 +47,7 @@ export class ConcatList extends BaseObservableList implements IListObserve onReset(): void { // TODO: not ideal if other source lists are large // but working impl for now - // reset, and + // reset, and this.emitReset(); let idx = 0; for(const item of this) { @@ -102,7 +102,7 @@ export class ConcatList extends BaseObservableList implements IListObserve } return result; } - } + }; } } diff --git a/src/observable/map/JoinedMap.ts b/src/observable/map/JoinedMap.ts index 8973f1bf..fb67e934 100644 --- a/src/observable/map/JoinedMap.ts +++ b/src/observable/map/JoinedMap.ts @@ -19,7 +19,7 @@ import {config} from "./config"; import {FilteredMap} from "./FilteredMap.js"; import {MappedMap} from "./MappedMap.js"; import {SortedMapList} from "../list/SortedMapList.js"; -import {SubscriptionHandle} from "../BaseObservable" +import {SubscriptionHandle} from "../BaseObservable"; export class JoinedMap extends BaseObservableMap {