mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
fixes AsyncMappedList
This commit is contained in:
parent
77f21f7a91
commit
ebd8c0751a
@ -22,7 +22,7 @@ export class AsyncMappedList<F,T> extends BaseMappedList<F,T,Promise<T>> impleme
|
|||||||
private _eventQueue: AsyncEvent<F>[] | null = null;
|
private _eventQueue: AsyncEvent<F>[] | null = null;
|
||||||
private _flushing: boolean = false;
|
private _flushing: boolean = false;
|
||||||
|
|
||||||
async onSubscribeFirst(): Promise<void> {
|
onSubscribeFirst(): void {
|
||||||
this._sourceUnsubscribe = this._sourceList.subscribe(this);
|
this._sourceUnsubscribe = this._sourceList.subscribe(this);
|
||||||
this._eventQueue = [];
|
this._eventQueue = [];
|
||||||
this._mappedValues = [];
|
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));
|
this._eventQueue.push(new AddEvent(idx, item));
|
||||||
idx += 1;
|
idx += 1;
|
||||||
}
|
}
|
||||||
await this._flush();
|
void this._flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
async _flush(): Promise<void> {
|
async _flush(): Promise<void> {
|
||||||
@ -49,38 +49,38 @@ export class AsyncMappedList<F,T> extends BaseMappedList<F,T,Promise<T>> impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async onReset(): Promise<void> {
|
onReset(): void {
|
||||||
if (this._eventQueue) {
|
if (this._eventQueue) {
|
||||||
this._eventQueue.push(new ResetEvent());
|
this._eventQueue.push(new ResetEvent());
|
||||||
await this._flush();
|
void this._flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async onAdd(index: number, value: F): Promise<void> {
|
onAdd(index: number, value: F): void {
|
||||||
if (this._eventQueue) {
|
if (this._eventQueue) {
|
||||||
this._eventQueue.push(new AddEvent(index, value));
|
this._eventQueue.push(new AddEvent(index, value));
|
||||||
await this._flush();
|
void this._flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async onUpdate(index: number, value: F, params: any): Promise<void> {
|
onUpdate(index: number, value: F, params: any): void {
|
||||||
if (this._eventQueue) {
|
if (this._eventQueue) {
|
||||||
this._eventQueue.push(new UpdateEvent(index, value, params));
|
this._eventQueue.push(new UpdateEvent(index, value, params));
|
||||||
await this._flush();
|
void this._flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async onRemove(index: number): Promise<void> {
|
onRemove(index: number): void {
|
||||||
if (this._eventQueue) {
|
if (this._eventQueue) {
|
||||||
this._eventQueue.push(new RemoveEvent(index));
|
this._eventQueue.push(new RemoveEvent(index));
|
||||||
await this._flush();
|
void this._flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async onMove(fromIdx: number, toIdx: number): Promise<void> {
|
onMove(fromIdx: number, toIdx: number): void {
|
||||||
if (this._eventQueue) {
|
if (this._eventQueue) {
|
||||||
this._eventQueue.push(new MoveEvent(fromIdx, toIdx));
|
this._eventQueue.push(new MoveEvent(fromIdx, toIdx));
|
||||||
await this._flush();
|
void this._flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ export class ApplyMap<K, V> extends BaseObservableMap<K, V> {
|
|||||||
private _subscription?: SubscriptionHandle;
|
private _subscription?: SubscriptionHandle;
|
||||||
private _apply?: Apply<K, V>;
|
private _apply?: Apply<K, V>;
|
||||||
|
|
||||||
|
|
||||||
constructor(source: BaseObservableMap<K, V>, apply?: Apply<K, V>) {
|
constructor(source: BaseObservableMap<K, V>, apply?: Apply<K, V>) {
|
||||||
super();
|
super();
|
||||||
this._source = source;
|
this._source = source;
|
||||||
|
Loading…
Reference in New Issue
Block a user