@base-framework/base 3.6.3 → 3.6.5
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.
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
* @class
|
|
7
7
|
*/
|
|
8
8
|
export class Publisher {
|
|
9
|
+
/**
|
|
10
|
+
* Depth limit for nested object publishing to prevent infinite recursion
|
|
11
|
+
* @type {number}
|
|
12
|
+
*/
|
|
13
|
+
static MAX_DEPTH: number;
|
|
9
14
|
/**
|
|
10
15
|
* This will publish deep data.
|
|
11
16
|
*
|
|
@@ -22,9 +27,11 @@ export class Publisher {
|
|
|
22
27
|
* @param {string} pathString
|
|
23
28
|
* @param {*} obj
|
|
24
29
|
* @param {function} callBack
|
|
30
|
+
* @param {?WeakSet} [seen] - Set of seen objects to detect circular refs
|
|
31
|
+
* @param {number} [depth] - Current recursion depth
|
|
25
32
|
* @returns {void}
|
|
26
33
|
*/
|
|
27
|
-
static publish(pathString: string, obj: any, callBack: Function): void;
|
|
34
|
+
static publish(pathString: string, obj: any, callBack: Function, seen?: WeakSet<any> | null, depth?: number): void;
|
|
28
35
|
/**
|
|
29
36
|
* This will publish an array to the data binder.
|
|
30
37
|
*
|
|
@@ -32,9 +39,11 @@ export class Publisher {
|
|
|
32
39
|
* @param {string} pathString
|
|
33
40
|
* @param {Array<any>} obj
|
|
34
41
|
* @param {function} callBack
|
|
42
|
+
* @param {WeakSet} seen - Set of seen objects
|
|
43
|
+
* @param {number} depth - Current recursion depth
|
|
35
44
|
* @returns {void}
|
|
36
45
|
*/
|
|
37
|
-
protected static publishArray(pathString: string, obj: Array<any>, callBack: Function): void;
|
|
46
|
+
protected static publishArray(pathString: string, obj: Array<any>, callBack: Function, seen: WeakSet<any>, depth: number): void;
|
|
38
47
|
/**
|
|
39
48
|
* This will publish an object to the data binder.
|
|
40
49
|
*
|
|
@@ -42,9 +51,11 @@ export class Publisher {
|
|
|
42
51
|
* @param {string} pathString
|
|
43
52
|
* @param {object} obj
|
|
44
53
|
* @param {function} callBack
|
|
54
|
+
* @param {WeakSet} seen - Set of seen objects
|
|
55
|
+
* @param {number} depth - Current recursion depth
|
|
45
56
|
* @returns {void}
|
|
46
57
|
*/
|
|
47
|
-
protected static publishObject(pathString: string, obj: object, callBack: Function): void;
|
|
58
|
+
protected static publishObject(pathString: string, obj: object, callBack: Function, seen: WeakSet<any>, depth: number): void;
|
|
48
59
|
/**
|
|
49
60
|
* This will check if the value is an object and publish
|
|
50
61
|
* the value or the object.
|
|
@@ -53,7 +64,9 @@ export class Publisher {
|
|
|
53
64
|
* @param {string} subPath
|
|
54
65
|
* @param {*} val
|
|
55
66
|
* @param {function} callBack
|
|
67
|
+
* @param {WeakSet} seen - Set of seen objects
|
|
68
|
+
* @param {number} depth - Current recursion depth
|
|
56
69
|
* @returns {void}
|
|
57
70
|
*/
|
|
58
|
-
protected static _checkPublish(subPath: string, val: any, callBack: Function): void;
|
|
71
|
+
protected static _checkPublish(subPath: string, val: any, callBack: Function, seen: WeakSet<any>, depth: number): void;
|
|
59
72
|
}
|
|
@@ -24,6 +24,23 @@ export class DataPubSub {
|
|
|
24
24
|
* @protected
|
|
25
25
|
*/
|
|
26
26
|
protected flushScheduled: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Flag to track if currently flushing
|
|
29
|
+
* @type {boolean}
|
|
30
|
+
* @protected
|
|
31
|
+
*/
|
|
32
|
+
protected isFlushing: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Counter for flush iterations (infinite loop detection)
|
|
35
|
+
* @type {number}
|
|
36
|
+
* @protected
|
|
37
|
+
*/
|
|
38
|
+
protected flushIterations: number;
|
|
39
|
+
/**
|
|
40
|
+
* Maximum flush iterations before warning
|
|
41
|
+
* @type {number}
|
|
42
|
+
*/
|
|
43
|
+
maxFlushIterations: number;
|
|
27
44
|
/**
|
|
28
45
|
* Enable/disable batching (useful for testing)
|
|
29
46
|
* @type {boolean}
|
|
@@ -85,6 +102,7 @@ export class DataPubSub {
|
|
|
85
102
|
/**
|
|
86
103
|
* Schedule a flush in a microtask.
|
|
87
104
|
* Ensures only one flush is scheduled at a time.
|
|
105
|
+
* If currently flushing, updates are queued and will be processed after current flush.
|
|
88
106
|
*
|
|
89
107
|
* @returns {void}
|
|
90
108
|
*/
|
|
@@ -92,6 +110,8 @@ export class DataPubSub {
|
|
|
92
110
|
/**
|
|
93
111
|
* Flush all queued updates.
|
|
94
112
|
* Deduplicates updates (only last update per msg is applied).
|
|
113
|
+
* Handles recursive publishes by re-flushing until queue is empty.
|
|
114
|
+
* Detects infinite loops and breaks after maxFlushIterations.
|
|
95
115
|
*
|
|
96
116
|
* @returns {void}
|
|
97
117
|
*/
|