Project

General

Profile

1
import { KeyValueChangeRecord, KeyValueChanges, KeyValueDiffer, KeyValueDifferFactory } from './keyvalue_differs';
2
export declare class DefaultKeyValueDifferFactory<K, V> implements KeyValueDifferFactory {
3
    constructor();
4
    supports(obj: any): boolean;
5
    create<K, V>(): DefaultKeyValueDiffer<K, V>;
6
}
7
export declare class DefaultKeyValueDiffer<K, V> implements KeyValueDiffer<K, V>, KeyValueChanges<K, V> {
8
    private _records;
9
    private _mapHead;
10
    private _appendAfter;
11
    private _previousMapHead;
12
    private _changesHead;
13
    private _changesTail;
14
    private _additionsHead;
15
    private _additionsTail;
16
    private _removalsHead;
17
    private _removalsTail;
18
    readonly isDirty: boolean;
19
    forEachItem(fn: (r: KeyValueChangeRecord<K, V>) => void): void;
20
    forEachPreviousItem(fn: (r: KeyValueChangeRecord<K, V>) => void): void;
21
    forEachChangedItem(fn: (r: KeyValueChangeRecord<K, V>) => void): void;
22
    forEachAddedItem(fn: (r: KeyValueChangeRecord<K, V>) => void): void;
23
    forEachRemovedItem(fn: (r: KeyValueChangeRecord<K, V>) => void): void;
24
    diff(map?: Map<any, any> | {
25
        [k: string]: any;
26
    } | null): any;
27
    onDestroy(): void;
28
    /**
29
     * Check the current state of the map vs the previous.
30
     * The algorithm is optimised for when the keys do no change.
31
     */
32
    check(map: Map<any, any> | {
33
        [k: string]: any;
34
    }): boolean;
35
    /**
36
     * Inserts a record before `before` or append at the end of the list when `before` is null.
37
     *
38
     * Notes:
39
     * - This method appends at `this._appendAfter`,
40
     * - This method updates `this._appendAfter`,
41
     * - The return value is the new value for the insertion pointer.
42
     */
43
    private _insertBeforeOrAppend(before, record);
44
    private _getOrCreateRecordForKey(key, value);
45
    private _maybeAddToChanges(record, newValue);
46
    private _addToAdditions(record);
47
    private _addToChanges(record);
48
}
(2-2/4)