@base-framework/base 3.8.3 → 3.9.0
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.
- package/dist/base.js +1 -1
- package/dist/chunks/chunk-42TNSLMZ.js +2 -0
- package/dist/chunks/chunk-5J4KRUCV.js +2 -0
- package/dist/chunks/chunk-6WNRG62Q.js +2 -0
- package/dist/chunks/chunk-C25U5UGH.js +2 -0
- package/dist/chunks/chunk-G66XUIA2.js +2 -0
- package/dist/chunks/chunk-IA7UI2XV.js +2 -0
- package/dist/chunks/chunk-IJTDFF7P.js +2 -0
- package/dist/chunks/chunk-MUCZUIHP.js +2 -0
- package/dist/chunks/chunk-P6ZMMTA3.js +2 -0
- package/dist/chunks/chunk-REMYPPWA.js +2 -0
- package/dist/modules/component.js +1 -1
- package/dist/modules/data.js +1 -1
- package/dist/modules/html.js +1 -1
- package/dist/modules/router.js +1 -1
- package/dist/modules/state.js +1 -1
- package/dist/types/modules/data/types/basic-data.d.ts +4 -4
- package/dist/types/modules/data/types/deep-data/deep-data.d.ts +0 -3
- package/dist/types/modules/data-binder/data-binder.d.ts +9 -0
- package/dist/types/modules/data-binder/data-pub-sub.d.ts +58 -4
- package/dist/types/modules/state/state-tracker.d.ts +2 -2
- package/dist/types/modules/state/state.d.ts +2 -2
- package/package.json +1 -1
|
@@ -7,11 +7,29 @@
|
|
|
7
7
|
* @class
|
|
8
8
|
*/
|
|
9
9
|
export class DataPubSub {
|
|
10
|
+
/**
|
|
11
|
+
* This will create a data pub sub.
|
|
12
|
+
*
|
|
13
|
+
* @constructor
|
|
14
|
+
* @param {boolean} [indexPrefixes=false] Maintain an index of
|
|
15
|
+
* subscribed messages grouped by their `prefix:` segment. Used by
|
|
16
|
+
* the data binder so deep data can publish only to subscribed
|
|
17
|
+
* paths instead of walking every node of a value.
|
|
18
|
+
*/
|
|
19
|
+
constructor(indexPrefixes?: boolean);
|
|
10
20
|
/**
|
|
11
21
|
* @type {Map} callBacks
|
|
12
22
|
* @protected
|
|
13
23
|
*/
|
|
14
24
|
protected callBacks: Map<any, any>;
|
|
25
|
+
/**
|
|
26
|
+
* Index of subscribed messages keyed by message prefix
|
|
27
|
+
* (substring through the first ':'). Null when disabled.
|
|
28
|
+
*
|
|
29
|
+
* @type {Map<string, Set<string>>|null}
|
|
30
|
+
* @protected
|
|
31
|
+
*/
|
|
32
|
+
protected prefixIndex: Map<string, Set<string>> | null;
|
|
15
33
|
/**
|
|
16
34
|
* Queue for batching publish calls
|
|
17
35
|
* @type {Map<string, Array>}
|
|
@@ -81,19 +99,55 @@ export class DataPubSub {
|
|
|
81
99
|
/**
|
|
82
100
|
* This will add a subscriber.
|
|
83
101
|
*
|
|
102
|
+
* Tokens are numbers — string conversion was allocating a new
|
|
103
|
+
* string per watcher during page builds. Tokens are opaque to
|
|
104
|
+
* callers and only round-trip back into off().
|
|
105
|
+
*
|
|
84
106
|
* @param {string} msg
|
|
85
107
|
* @param {function} callBack
|
|
86
|
-
* @returns {
|
|
108
|
+
* @returns {number} The subscriber token.
|
|
109
|
+
*/
|
|
110
|
+
on(msg: string, callBack: Function): number;
|
|
111
|
+
/**
|
|
112
|
+
* This will add a message to the prefix index.
|
|
113
|
+
*
|
|
114
|
+
* @protected
|
|
115
|
+
* @param {string} msg
|
|
116
|
+
* @returns {void}
|
|
117
|
+
*/
|
|
118
|
+
protected _indexMessage(msg: string): void;
|
|
119
|
+
/**
|
|
120
|
+
* This will remove a message from the prefix index.
|
|
121
|
+
*
|
|
122
|
+
* @protected
|
|
123
|
+
* @param {string} msg
|
|
124
|
+
* @returns {void}
|
|
125
|
+
*/
|
|
126
|
+
protected _unindexMessage(msg: string): void;
|
|
127
|
+
/**
|
|
128
|
+
* This will get the subscribed messages for a prefix
|
|
129
|
+
* (e.g. 'dt-3:'). Returns null when prefix indexing is
|
|
130
|
+
* disabled or no messages are subscribed.
|
|
131
|
+
*
|
|
132
|
+
* @param {string} prefix
|
|
133
|
+
* @returns {Set<string>|null}
|
|
134
|
+
*/
|
|
135
|
+
getPrefixMessages(prefix: string): Set<string> | null;
|
|
136
|
+
/**
|
|
137
|
+
* This will get the subscribed message keys. Used by deep data
|
|
138
|
+
* to publish only to subscribed paths.
|
|
139
|
+
*
|
|
140
|
+
* @returns {IterableIterator<string>}
|
|
87
141
|
*/
|
|
88
|
-
|
|
142
|
+
getMessages(): IterableIterator<string>;
|
|
89
143
|
/**
|
|
90
144
|
* This will remove a subscriber.
|
|
91
145
|
*
|
|
92
146
|
* @param {string} msg
|
|
93
|
-
* @param {
|
|
147
|
+
* @param {number} token
|
|
94
148
|
* @returns {void}
|
|
95
149
|
*/
|
|
96
|
-
off(msg: string, token:
|
|
150
|
+
off(msg: string, token: number): void;
|
|
97
151
|
/**
|
|
98
152
|
* This will delete a message.
|
|
99
153
|
*
|
|
@@ -70,9 +70,9 @@ export class StateTracker {
|
|
|
70
70
|
* @param {string} targetId
|
|
71
71
|
* @param {string} action
|
|
72
72
|
* @param {function} callBack
|
|
73
|
-
* @returns {?
|
|
73
|
+
* @returns {?number}
|
|
74
74
|
*/
|
|
75
|
-
static on(targetId: string, action: string, callBack: Function):
|
|
75
|
+
static on(targetId: string, action: string, callBack: Function): number | null;
|
|
76
76
|
/**
|
|
77
77
|
* This will remove a subscriber from an action.
|
|
78
78
|
*
|
|
@@ -29,9 +29,9 @@ export class State extends SimpleData {
|
|
|
29
29
|
* whole action is removed.
|
|
30
30
|
*
|
|
31
31
|
* @param {string} action
|
|
32
|
-
* @param {
|
|
32
|
+
* @param {number} [token]
|
|
33
33
|
* @returns {this}
|
|
34
34
|
*/
|
|
35
|
-
removeAction(action: string, token?:
|
|
35
|
+
removeAction(action: string, token?: number): this;
|
|
36
36
|
}
|
|
37
37
|
import { SimpleData } from '../data/data.js';
|