fixing linting errors

This commit is contained in:
Isaiah Becker-Mayer 2022-07-09 11:57:58 -04:00
parent 081cc05fa6
commit 674e7bd1c6
4 changed files with 21 additions and 21 deletions

View File

@ -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<number>(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]);
}
}
};
}

View File

@ -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<F,T> extends BaseMappedList<F,T,Promise<T>> implements IListObserver<F> {
private _eventQueue: AsyncEvent<F>[] | null = null;
private _flushing: boolean = false;
onSubscribeFirst(): void {
async onSubscribeFirst(): Promise<void> {
this._sourceUnsubscribe = this._sourceList.subscribe(this);
this._eventQueue = [];
this._mappedValues = [];
@ -31,7 +31,7 @@ export class AsyncMappedList<F,T> extends BaseMappedList<F,T,Promise<T>> impleme
this._eventQueue.push(new AddEvent(idx, item));
idx += 1;
}
this._flush();
await this._flush();
}
async _flush(): Promise<void> {
@ -49,38 +49,38 @@ export class AsyncMappedList<F,T> extends BaseMappedList<F,T,Promise<T>> impleme
}
}
onReset(): void {
async onReset(): Promise<void> {
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<void> {
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<void> {
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<void> {
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<void> {
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);
}
}
}
};
}

View File

@ -102,7 +102,7 @@ export class ConcatList<T> extends BaseObservableList<T> implements IListObserve
}
return result;
}
}
};
}
}

View File

@ -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<K, V> extends BaseObservableMap<K, V> {