@ms-cloudpack/data-bus 0.2.1 → 0.3.1
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/lib/addProvider.js +1 -1
- package/lib/addProvider.js.map +1 -1
- package/lib/createDataBus.d.ts.map +1 -1
- package/lib/createDataBus.js +18 -1
- package/lib/createDataBus.js.map +1 -1
- package/lib/getNode.js +2 -2
- package/lib/getNode.js.map +1 -1
- package/lib/subscribe.js +3 -3
- package/lib/subscribe.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/types/DataBus.d.ts +1 -0
- package/lib/types/DataBus.d.ts.map +1 -1
- package/lib/types/DataBus.js.map +1 -1
- package/package.json +1 -1
package/lib/addProvider.js
CHANGED
|
@@ -4,7 +4,7 @@ import { getNode } from './getNode.js';
|
|
|
4
4
|
*/
|
|
5
5
|
export function addProvider(state, provider) {
|
|
6
6
|
const { node } = getNode(state, provider.path, true);
|
|
7
|
-
node.providers
|
|
7
|
+
node.providers ??= [];
|
|
8
8
|
node.providers.push(provider);
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=addProvider.js.map
|
package/lib/addProvider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addProvider.js","sourceRoot":"","sources":["../src/addProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAIvC;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAmB,EAAE,QAAyB;IACxE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAErD,IAAI,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"addProvider.js","sourceRoot":"","sources":["../src/addProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAIvC;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAmB,EAAE,QAAyB;IACxE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAErD,IAAI,CAAC,SAAS,KAAK,EAAE,CAAC;IACtB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC","sourcesContent":["import { getNode } from './getNode.js';\nimport type { DataBusProvider } from './types/DataBusProvider.js';\nimport type { DataBusState } from './types/DataBusState.js';\n\n/**\n * Adds a provider.\n */\nexport function addProvider(state: DataBusState, provider: DataBusProvider) {\n const { node } = getNode(state, provider.path, true);\n\n node.providers ??= [];\n node.providers.push(provider);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDataBus.d.ts","sourceRoot":"","sources":["../src/createDataBus.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"createDataBus.d.ts","sourceRoot":"","sources":["../src/createDataBus.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGlD;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAyCvC"}
|
package/lib/createDataBus.js
CHANGED
|
@@ -10,13 +10,30 @@ export function createDataBus() {
|
|
|
10
10
|
const state = {
|
|
11
11
|
root: createNode(),
|
|
12
12
|
};
|
|
13
|
+
const disposables = [];
|
|
13
14
|
const bus = {
|
|
14
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
16
|
publish: (path, value) => publish(state, bus, path, value),
|
|
16
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
18
|
getData: (path) => getData(state, path),
|
|
18
|
-
subscribe: (path, change) =>
|
|
19
|
+
subscribe: (path, change) => {
|
|
20
|
+
const internalDispose = subscribe(state, bus, path, change);
|
|
21
|
+
const dispose = () => {
|
|
22
|
+
const index = disposables.indexOf(dispose);
|
|
23
|
+
if (index !== -1) {
|
|
24
|
+
disposables.splice(index, 1);
|
|
25
|
+
}
|
|
26
|
+
internalDispose();
|
|
27
|
+
};
|
|
28
|
+
disposables.push(dispose);
|
|
29
|
+
return dispose;
|
|
30
|
+
},
|
|
19
31
|
addProvider: (provider) => addProvider(state, provider),
|
|
32
|
+
dispose: () => {
|
|
33
|
+
for (const dispose of disposables) {
|
|
34
|
+
dispose();
|
|
35
|
+
}
|
|
36
|
+
},
|
|
20
37
|
};
|
|
21
38
|
return bus;
|
|
22
39
|
}
|
package/lib/createDataBus.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDataBus.js","sourceRoot":"","sources":["../src/createDataBus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"createDataBus.js","sourceRoot":"","sources":["../src/createDataBus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAO3C;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,KAAK,GAAiB;QAC1B,IAAI,EAAE,UAAU,EAAE;KACnB,CAAC;IAEF,MAAM,WAAW,GAAsB,EAAE,CAAC;IAC1C,MAAM,GAAG,GAAG;QACV,8DAA8D;QAC9D,OAAO,EAAE,CAAC,IAAc,EAAE,KAAU,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC;QAEzE,8DAA8D;QAC9D,OAAO,EAAE,CAAc,IAAc,EAAE,EAAE,CAAC,OAAO,CAAQ,KAAK,EAAE,IAAI,CAAC;QAErE,SAAS,EAAE,CAAC,IAAc,EAAE,MAA6B,EAAE,EAAE;YAC3D,MAAM,eAAe,GAAG,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;YAE5D,MAAM,OAAO,GAAG,GAAG,EAAE;gBACnB,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBAE3C,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;oBAChB,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;iBAC9B;gBAED,eAAe,EAAE,CAAC;YACpB,CAAC,CAAC;YAEF,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAE1B,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,WAAW,EAAE,CAAC,QAAyB,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC;QAExE,OAAO,EAAE,GAAG,EAAE;YACZ,KAAK,MAAM,OAAO,IAAI,WAAW,EAAE;gBACjC,OAAO,EAAE,CAAC;aACX;QACH,CAAC;KACF,CAAC;IAEF,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import { addProvider } from './addProvider.js';\nimport { createNode } from './createNode.js';\nimport { getData } from './getData.js';\nimport { publish } from './publish.js';\nimport { subscribe } from './subscribe.js';\nimport type { DataBusChangeFunction } from './types/DataBusChangeFunction.js';\nimport type { DataBusProvider } from './types/DataBusProvider.js';\nimport type { DataBusState } from './types/DataBusState.js';\nimport type { DataBus } from './types/DataBus.js';\nimport type { DisposeFunction } from './types/DisposeFunction.js';\n\n/**\n * Creates a new data bus instance.\n */\nexport function createDataBus(): DataBus {\n const state: DataBusState = {\n root: createNode(),\n };\n\n const disposables: DisposeFunction[] = [];\n const bus = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n publish: (path: string[], value: any) => publish(state, bus, path, value),\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getData: <TData = any>(path: string[]) => getData<TData>(state, path),\n\n subscribe: (path: string[], change: DataBusChangeFunction) => {\n const internalDispose = subscribe(state, bus, path, change);\n\n const dispose = () => {\n const index = disposables.indexOf(dispose);\n\n if (index !== -1) {\n disposables.splice(index, 1);\n }\n\n internalDispose();\n };\n\n disposables.push(dispose);\n\n return dispose;\n },\n\n addProvider: (provider: DataBusProvider) => addProvider(state, provider),\n\n dispose: () => {\n for (const dispose of disposables) {\n dispose();\n }\n },\n };\n\n return bus;\n}\n"]}
|
package/lib/getNode.js
CHANGED
|
@@ -6,11 +6,11 @@ export function getNode(state, path, createPath) {
|
|
|
6
6
|
while (node && index < path.length) {
|
|
7
7
|
const pathName = path[index++];
|
|
8
8
|
if (!node.children?.[pathName] && createPath) {
|
|
9
|
-
node.children
|
|
9
|
+
node.children ??= {};
|
|
10
10
|
node.children[pathName] = createNode(pathName);
|
|
11
11
|
}
|
|
12
12
|
node = node.children?.[pathName];
|
|
13
|
-
nodePath.push(node);
|
|
13
|
+
node && nodePath.push(node);
|
|
14
14
|
}
|
|
15
15
|
return {
|
|
16
16
|
node,
|
package/lib/getNode.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNode.js","sourceRoot":"","sources":["../src/getNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAqB7C,MAAM,UAAU,OAAO,CACrB,KAAmB,EACnB,IAAc,EACd,UAAoB;IAKpB,IAAI,KAAK,GAAG,CAAC,CAAC;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Node.js';\nimport type { DataBusNode } from './types/DataBusNode.js';\nimport type { DataBusState } from './types/DataBusState.js';\n\nexport function getNode(\n state: DataBusState,\n path: string[],\n): {\n node: DataBusNode;\n nodePath: DataBusNode[];\n};\n\nexport function getNode(\n state: DataBusState,\n path: string[],\n createPath: true,\n): {\n node: DataBusNode;\n nodePath: DataBusNode[];\n};\n\nexport function getNode(\n state: DataBusState,\n path: string[],\n createPath?: boolean,\n): {\n node: DataBusNode | undefined;\n nodePath: DataBusNode[];\n} {\n let index = 0;\n let node: DataBusNode | undefined = state.root;\n const nodePath: DataBusNode[] = [state.root];\n\n while (node && index < path.length) {\n const pathName = path[index++];\n\n if (!node.children?.[pathName] && createPath) {\n node.children ??= {};\n node.children[pathName] = createNode(pathName);\n }\n\n node = node.children?.[pathName];\n node && nodePath.push(node);\n }\n\n return {\n node,\n nodePath,\n };\n}\n"]}
|
package/lib/subscribe.js
CHANGED
|
@@ -4,7 +4,7 @@ export function subscribe(state, bus, path, change) {
|
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
5
5
|
const { value } = node;
|
|
6
6
|
const pathString = path.join('/');
|
|
7
|
-
node.subscribers
|
|
7
|
+
node.subscribers ??= new Set();
|
|
8
8
|
node.subscribers.add(change);
|
|
9
9
|
// Fire the initial change with the value.
|
|
10
10
|
if (value !== undefined) {
|
|
@@ -14,9 +14,9 @@ export function subscribe(state, bus, path, change) {
|
|
|
14
14
|
for (let index = nodePath.length - 1; index >= 0; index--) {
|
|
15
15
|
const currentNode = nodePath[index];
|
|
16
16
|
if (currentNode.providers?.length) {
|
|
17
|
-
const activeProviders = (currentNode.activeProviders
|
|
17
|
+
const activeProviders = (currentNode.activeProviders ??= {});
|
|
18
18
|
currentNode.providers.forEach((provider) => {
|
|
19
|
-
activeProviders[pathString]
|
|
19
|
+
activeProviders[pathString] ??= { provider, count: 0 };
|
|
20
20
|
if (activeProviders[pathString].count === 0) {
|
|
21
21
|
provider.onActivate?.({ path, bus });
|
|
22
22
|
}
|
package/lib/subscribe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscribe.js","sourceRoot":"","sources":["../src/subscribe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAMvC,MAAM,UAAU,SAAS,CACvB,KAAmB,EACnB,GAAY,EACZ,IAAc,EACd,MAA6B;IAE7B,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACtD,mEAAmE;IACnE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAElC,IAAI,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"subscribe.js","sourceRoot":"","sources":["../src/subscribe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAMvC,MAAM,UAAU,SAAS,CACvB,KAAmB,EACnB,GAAY,EACZ,IAAc,EACd,MAA6B;IAE7B,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACtD,mEAAmE;IACnE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAElC,IAAI,CAAC,WAAW,KAAK,IAAI,GAAG,EAAyB,CAAC;IACtD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAE7B,0CAA0C;IAC1C,IAAI,KAAK,KAAK,SAAS,EAAE;QACvB,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;KAC5B;IAED,8DAA8D;IAC9D,KAAK,IAAI,KAAK,GAA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,CAAC,CAAC;wBACrD,OAAO,WAAW,CAAC,eAAe,EAAE,CAAC,UAAU,CAAC,CAAC;qBAClD;iBACF;aACF;SACF;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { getNode } from './getNode.js';\nimport type { DataBusChangeFunction } from './types/DataBusChangeFunction.js';\nimport type { DisposeFunction } from './types/DisposeFunction.js';\nimport type { DataBusState } from './types/DataBusState.js';\nimport type { DataBus } from './types/DataBus.js';\n\nexport function subscribe(\n state: DataBusState,\n bus: DataBus,\n path: string[],\n change: DataBusChangeFunction,\n): DisposeFunction {\n const { node, nodePath } = getNode(state, path, true);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const { value } = node;\n const pathString = path.join('/');\n\n node.subscribers ??= new Set<DataBusChangeFunction>();\n node.subscribers.add(change);\n\n // Fire the initial change with the value.\n if (value !== undefined) {\n change(value, value, path);\n }\n\n // Activate any deactivated providers available for this path.\n for (let index = nodePath.length - 1; index >= 0; index--) {\n const currentNode = nodePath[index];\n\n if (currentNode.providers?.length) {\n const activeProviders = (currentNode.activeProviders ??= {});\n\n currentNode.providers.forEach((provider) => {\n activeProviders[pathString] ??= { provider, count: 0 };\n\n if (activeProviders[pathString].count === 0) {\n provider.onActivate?.({ path, bus });\n }\n\n activeProviders[pathString].count++;\n });\n }\n }\n\n return () => {\n node.subscribers?.delete(change);\n\n // Deactivate providers.\n for (let index = nodePath.length - 1; index >= 0; index--) {\n const currentNode = nodePath[index];\n\n if (currentNode.providers?.length) {\n const activeRecord = currentNode.activeProviders?.[pathString];\n\n if (activeRecord) {\n activeRecord.count--;\n\n if (!activeRecord.count) {\n activeRecord?.provider.onDeactivate?.({ path, bus });\n delete currentNode.activeProviders?.[pathString];\n }\n }\n }\n }\n };\n}\n"]}
|
package/lib/tsdoc-metadata.json
CHANGED
package/lib/types/DataBus.d.ts
CHANGED
|
@@ -6,5 +6,6 @@ export interface DataBus {
|
|
|
6
6
|
subscribe: <TData = any>(path: string[], callback: DataBusChangeFunction<TData>) => DisposeFunction;
|
|
7
7
|
getData: <TData = any>(path: string[]) => TData | undefined;
|
|
8
8
|
addProvider: (provider: DataBusProvider) => void;
|
|
9
|
+
dispose: () => void;
|
|
9
10
|
}
|
|
10
11
|
//# sourceMappingURL=DataBus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataBus.d.ts","sourceRoot":"","sources":["../../src/types/DataBus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,WAAW,OAAO;IAEtB,OAAO,EAAE,CAAC,KAAK,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAE7D,SAAS,EAAE,CAAC,KAAK,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,qBAAqB,CAAC,KAAK,CAAC,KAAK,eAAe,CAAC;IAEpG,OAAO,EAAE,CAAC,KAAK,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,KAAK,GAAG,SAAS,CAAC;IAC5D,WAAW,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"DataBus.d.ts","sourceRoot":"","sources":["../../src/types/DataBus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,WAAW,OAAO;IAEtB,OAAO,EAAE,CAAC,KAAK,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAE7D,SAAS,EAAE,CAAC,KAAK,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,qBAAqB,CAAC,KAAK,CAAC,KAAK,eAAe,CAAC;IAEpG,OAAO,EAAE,CAAC,KAAK,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,KAAK,GAAG,SAAS,CAAC;IAC5D,WAAW,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;IACjD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB"}
|
package/lib/types/DataBus.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataBus.js","sourceRoot":"","sources":["../../src/types/DataBus.ts"],"names":[],"mappings":"","sourcesContent":["import type { DataBusChangeFunction } from './DataBusChangeFunction.js';\nimport type { DisposeFunction } from './DisposeFunction.js';\nimport type { DataBusProvider } from './DataBusProvider.js';\n\nexport interface DataBus {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n publish: <TData = any>(path: string[], value: TData) => void;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n subscribe: <TData = any>(path: string[], callback: DataBusChangeFunction<TData>) => DisposeFunction;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getData: <TData = any>(path: string[]) => TData | undefined;\n addProvider: (provider: DataBusProvider) => void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DataBus.js","sourceRoot":"","sources":["../../src/types/DataBus.ts"],"names":[],"mappings":"","sourcesContent":["import type { DataBusChangeFunction } from './DataBusChangeFunction.js';\nimport type { DisposeFunction } from './DisposeFunction.js';\nimport type { DataBusProvider } from './DataBusProvider.js';\n\nexport interface DataBus {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n publish: <TData = any>(path: string[], value: TData) => void;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n subscribe: <TData = any>(path: string[], callback: DataBusChangeFunction<TData>) => DisposeFunction;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getData: <TData = any>(path: string[]) => TData | undefined;\n addProvider: (provider: DataBusProvider) => void;\n dispose: () => void;\n}\n"]}
|