reactronic 0.23.101 → 0.23.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,7 +2,7 @@ import { Collection, Item, CollectionReader } from '../util/Collection';
|
|
|
2
2
|
import { ObservableObject } from './Mvcc';
|
|
3
3
|
export declare abstract class ObservableCollection<T> extends ObservableObject implements CollectionReader<T> {
|
|
4
4
|
protected abstract impl: Collection<T>;
|
|
5
|
-
get
|
|
5
|
+
get isStrict(): boolean;
|
|
6
6
|
get count(): number;
|
|
7
7
|
get addedCount(): number;
|
|
8
8
|
get removedCount(): number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ObservableObject } from './Mvcc';
|
|
2
2
|
export class ObservableCollection extends ObservableObject {
|
|
3
|
-
get
|
|
3
|
+
get isStrict() { return this.impl.isStrict; }
|
|
4
4
|
get count() { return this.impl.count; }
|
|
5
5
|
get addedCount() { return this.impl.addedCount; }
|
|
6
6
|
get removedCount() { return this.impl.removedCount; }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type GetItemKey<T = unknown> = (item: T) => string | undefined;
|
|
2
2
|
export interface CollectionReader<T> {
|
|
3
|
-
readonly
|
|
3
|
+
readonly isStrict: boolean;
|
|
4
4
|
readonly count: number;
|
|
5
5
|
readonly addedCount: number;
|
|
6
6
|
readonly removedCount: number;
|
|
@@ -28,8 +28,8 @@ export interface Item<T> {
|
|
|
28
28
|
aux?: Item<T>;
|
|
29
29
|
}
|
|
30
30
|
export declare class Collection<T> implements CollectionReader<T> {
|
|
31
|
-
readonly strict: boolean;
|
|
32
31
|
readonly getKey: GetItemKey<T>;
|
|
32
|
+
private strict;
|
|
33
33
|
private map;
|
|
34
34
|
private tag;
|
|
35
35
|
private current;
|
|
@@ -37,7 +37,9 @@ export declare class Collection<T> implements CollectionReader<T> {
|
|
|
37
37
|
private removed;
|
|
38
38
|
private lastNotFoundKey;
|
|
39
39
|
private strictNextItem?;
|
|
40
|
-
constructor(
|
|
40
|
+
constructor(getKey: GetItemKey<T>, strict?: boolean);
|
|
41
|
+
get isStrict(): boolean;
|
|
42
|
+
set isStrict(value: boolean);
|
|
41
43
|
get count(): number;
|
|
42
44
|
get addedCount(): number;
|
|
43
45
|
get removedCount(): number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export class Collection {
|
|
2
|
-
constructor(
|
|
3
|
-
this.strict = strict;
|
|
2
|
+
constructor(getKey, strict = false) {
|
|
4
3
|
this.getKey = getKey;
|
|
4
|
+
this.strict = strict;
|
|
5
5
|
this.map = new Map();
|
|
6
6
|
this.tag = ~0;
|
|
7
7
|
this.current = new ItemChain();
|
|
@@ -10,6 +10,12 @@ export class Collection {
|
|
|
10
10
|
this.lastNotFoundKey = undefined;
|
|
11
11
|
this.strictNextItem = undefined;
|
|
12
12
|
}
|
|
13
|
+
get isStrict() { return this.strict; }
|
|
14
|
+
set isStrict(value) {
|
|
15
|
+
if (this.isMergeInProgress && this.current.count > 0)
|
|
16
|
+
throw new Error('cannot change strict mode in the middle of merge');
|
|
17
|
+
this.strict = value;
|
|
18
|
+
}
|
|
13
19
|
get count() {
|
|
14
20
|
return this.current.count;
|
|
15
21
|
}
|