@trops/dash-core 0.1.44 → 0.1.46
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/electron/index.js +20 -0
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +30 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +30 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -122,14 +122,36 @@ var event = {
|
|
|
122
122
|
this.list = new Map();
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
|
+
var ipcBridgeListener = null;
|
|
125
126
|
var DashboardPublisher = {
|
|
126
127
|
sub: function sub(eventType, action, uuid) {
|
|
127
128
|
event.on(eventType, action, uuid);
|
|
128
129
|
},
|
|
129
130
|
pub: function pub(eventType, content) {
|
|
131
|
+
var _window$mainApi;
|
|
130
132
|
event.emit(eventType, content);
|
|
131
|
-
|
|
132
|
-
//
|
|
133
|
+
|
|
134
|
+
// Forward to other windows via IPC bridge
|
|
135
|
+
if ((_window$mainApi = window.mainApi) !== null && _window$mainApi !== void 0 && _window$mainApi.widgetEvent) {
|
|
136
|
+
window.mainApi.widgetEvent.publish(eventType, content);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
enableIpcBridge: function enableIpcBridge() {
|
|
140
|
+
var _window$mainApi2;
|
|
141
|
+
if (ipcBridgeListener) return;
|
|
142
|
+
if (!((_window$mainApi2 = window.mainApi) !== null && _window$mainApi2 !== void 0 && _window$mainApi2.on)) return;
|
|
143
|
+
ipcBridgeListener = function ipcBridgeListener(_e, message) {
|
|
144
|
+
event.emit(message.eventType, message.content);
|
|
145
|
+
};
|
|
146
|
+
window.mainApi.on("widget-event:broadcast", ipcBridgeListener);
|
|
147
|
+
},
|
|
148
|
+
disableIpcBridge: function disableIpcBridge() {
|
|
149
|
+
var _window$mainApi3;
|
|
150
|
+
if (!ipcBridgeListener) return;
|
|
151
|
+
if ((_window$mainApi3 = window.mainApi) !== null && _window$mainApi3 !== void 0 && _window$mainApi3.removeListener) {
|
|
152
|
+
window.mainApi.removeListener("widget-event:broadcast", ipcBridgeListener);
|
|
153
|
+
}
|
|
154
|
+
ipcBridgeListener = null;
|
|
133
155
|
},
|
|
134
156
|
listeners: function listeners() {
|
|
135
157
|
return event.list;
|
|
@@ -2471,6 +2493,12 @@ var DashboardWrapper = function DashboardWrapper(_ref) {
|
|
|
2471
2493
|
w.setElectronApi(dashApi);
|
|
2472
2494
|
return w;
|
|
2473
2495
|
}, [dashApi]);
|
|
2496
|
+
React.useEffect(function () {
|
|
2497
|
+
DashboardPublisher.enableIpcBridge();
|
|
2498
|
+
return function () {
|
|
2499
|
+
return DashboardPublisher.disableIpcBridge();
|
|
2500
|
+
};
|
|
2501
|
+
}, []);
|
|
2474
2502
|
var providers = (appContext === null || appContext === void 0 ? void 0 : appContext.providers) || EMPTY_PROVIDERS;
|
|
2475
2503
|
var contextValue = React.useMemo(function () {
|
|
2476
2504
|
return {
|