@openfin/remote-adapter 40.101.1 → 40.102.2
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/out/remote-adapter.js +36 -37
- package/package.json +2 -2
package/out/remote-adapter.js
CHANGED
|
@@ -60,7 +60,7 @@ var __classPrivateFieldGet$e = (commonjsGlobal && commonjsGlobal.__classPrivateF
|
|
|
60
60
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
61
61
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
62
62
|
};
|
|
63
|
-
var _EmitterBase_emitterAccessor;
|
|
63
|
+
var _EmitterBase_emitterAccessor, _EmitterBase_deregisterOnceListeners;
|
|
64
64
|
Object.defineProperty(base, "__esModule", { value: true });
|
|
65
65
|
base.Reply = base.EmitterBase = base.Base = void 0;
|
|
66
66
|
const promises_1 = promises;
|
|
@@ -132,6 +132,7 @@ class EmitterBase extends Base {
|
|
|
132
132
|
super(wire);
|
|
133
133
|
this.topic = topic;
|
|
134
134
|
_EmitterBase_emitterAccessor.set(this, void 0);
|
|
135
|
+
_EmitterBase_deregisterOnceListeners.set(this, void 0);
|
|
135
136
|
this.eventNames = () => (this.hasEmitter() ? this.getOrCreateEmitter().eventNames() : []);
|
|
136
137
|
/**
|
|
137
138
|
* @internal
|
|
@@ -140,7 +141,28 @@ class EmitterBase extends Base {
|
|
|
140
141
|
return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
|
|
141
142
|
};
|
|
142
143
|
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$e(this, _EmitterBase_emitterAccessor, "f"));
|
|
143
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Cleans up after removal of a listener, e.g. deleting any lingering deregistration handlers for a
|
|
146
|
+
* `once` subscription.
|
|
147
|
+
*
|
|
148
|
+
* @remarks Implementing this as a `removeListener` handler ensures that direct removal of a listener
|
|
149
|
+
* on the base emitter will not leak additional core handlers. We could do this in the forwarding method,
|
|
150
|
+
* which would involve less "magic," but would be more-vulnerable to accidental re-introduction of a leak.
|
|
151
|
+
*/
|
|
152
|
+
this.cleanUpRemovedListener = (eventType, listener) => {
|
|
153
|
+
const deregister = __classPrivateFieldGet$e(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
|
|
154
|
+
if (deregister) {
|
|
155
|
+
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$e(this, _EmitterBase_emitterAccessor, "f"));
|
|
156
|
+
emitter.removeListener(eventType, deregister);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
this.getOrCreateEmitter = () => {
|
|
160
|
+
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$e(this, _EmitterBase_emitterAccessor, "f"));
|
|
161
|
+
if (!emitter.listeners('removeListener').includes(this.cleanUpRemovedListener)) {
|
|
162
|
+
emitter.on('removeListener', this.cleanUpRemovedListener);
|
|
163
|
+
}
|
|
164
|
+
return emitter;
|
|
165
|
+
};
|
|
144
166
|
this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
|
|
145
167
|
this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
|
|
146
168
|
this.registerEventListener = async (eventType, options = {}, applySubscription, undoSubscription) => {
|
|
@@ -172,13 +194,13 @@ class EmitterBase extends Base {
|
|
|
172
194
|
type: eventType
|
|
173
195
|
};
|
|
174
196
|
await this.wire.sendAction('unsubscribe-to-desktop-event', runtimeEvent).catch(() => null);
|
|
175
|
-
|
|
176
|
-
return emitter;
|
|
197
|
+
return this.getOrCreateEmitter();
|
|
177
198
|
}
|
|
178
199
|
// This will only be reached if unsubscribe from event that does not exist but do not want to error here
|
|
179
200
|
return Promise.resolve();
|
|
180
201
|
};
|
|
181
202
|
__classPrivateFieldSet$d(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
|
|
203
|
+
__classPrivateFieldSet$d(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
|
|
182
204
|
this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
|
|
183
205
|
}
|
|
184
206
|
/**
|
|
@@ -207,6 +229,7 @@ class EmitterBase extends Base {
|
|
|
207
229
|
*/
|
|
208
230
|
async once(eventType, listener, options) {
|
|
209
231
|
const deregister = () => this.deregisterEventListener(eventType);
|
|
232
|
+
__classPrivateFieldGet$e(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
|
|
210
233
|
await this.registerEventListener(eventType, options, (emitter) => {
|
|
211
234
|
emitter.once(eventType, deregister);
|
|
212
235
|
emitter.once(eventType, listener);
|
|
@@ -237,6 +260,7 @@ class EmitterBase extends Base {
|
|
|
237
260
|
*/
|
|
238
261
|
async prependOnceListener(eventType, listener, options) {
|
|
239
262
|
const deregister = () => this.deregisterEventListener(eventType);
|
|
263
|
+
__classPrivateFieldGet$e(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
|
|
240
264
|
await this.registerEventListener(eventType, options, (emitter) => {
|
|
241
265
|
emitter.prependOnceListener(eventType, listener);
|
|
242
266
|
emitter.once(eventType, deregister);
|
|
@@ -295,13 +319,13 @@ class EmitterBase extends Base {
|
|
|
295
319
|
return this;
|
|
296
320
|
}
|
|
297
321
|
deleteEmitterIfNothingRegistered(emitter) {
|
|
298
|
-
if (emitter.eventNames().
|
|
322
|
+
if (emitter.eventNames().every((type) => type === 'removeListener')) {
|
|
299
323
|
this.wire.eventAggregator.delete(__classPrivateFieldGet$e(this, _EmitterBase_emitterAccessor, "f"));
|
|
300
324
|
}
|
|
301
325
|
}
|
|
302
326
|
}
|
|
303
327
|
base.EmitterBase = EmitterBase;
|
|
304
|
-
_EmitterBase_emitterAccessor = new WeakMap();
|
|
328
|
+
_EmitterBase_emitterAccessor = new WeakMap(), _EmitterBase_deregisterOnceListeners = new WeakMap();
|
|
305
329
|
class Reply {
|
|
306
330
|
}
|
|
307
331
|
base.Reply = Reply;
|
|
@@ -4044,31 +4068,6 @@ function requireInteropBroker () {
|
|
|
4044
4068
|
if (!context.type) {
|
|
4045
4069
|
return { isValid: false, reason: 'Context must have a type property' };
|
|
4046
4070
|
}
|
|
4047
|
-
if (context.id && typeof context.id !== 'object') {
|
|
4048
|
-
return {
|
|
4049
|
-
isValid: false,
|
|
4050
|
-
reason: 'Context id must be an Object populated with key-value identifiers (if set)'
|
|
4051
|
-
};
|
|
4052
|
-
}
|
|
4053
|
-
if (context.id) {
|
|
4054
|
-
const { id } = context;
|
|
4055
|
-
const keys = Object.keys(id);
|
|
4056
|
-
let foundBadIdentifier = false;
|
|
4057
|
-
if (!keys.length) {
|
|
4058
|
-
return { isValid: false, reason: 'Context id must have at least one key-value identifier' };
|
|
4059
|
-
}
|
|
4060
|
-
keys.forEach((key) => {
|
|
4061
|
-
if (typeof key !== 'string' || typeof id[key] !== 'string') {
|
|
4062
|
-
foundBadIdentifier = true;
|
|
4063
|
-
}
|
|
4064
|
-
});
|
|
4065
|
-
if (foundBadIdentifier) {
|
|
4066
|
-
return { isValid: false, reason: 'Context id key-value identifiers must be of type string' };
|
|
4067
|
-
}
|
|
4068
|
-
}
|
|
4069
|
-
if (context.name && typeof context.name !== 'string') {
|
|
4070
|
-
return { isValid: false, reason: 'Context name must be of string type (if set)' };
|
|
4071
|
-
}
|
|
4072
4071
|
return { isValid: true };
|
|
4073
4072
|
}
|
|
4074
4073
|
// Util to check a client identity.
|
|
@@ -7257,9 +7256,9 @@ function requireInstance$1 () {
|
|
|
7257
7256
|
* getBounds().then(bounds => console.log(bounds)).catch(err => console.log(err));
|
|
7258
7257
|
* ```
|
|
7259
7258
|
*/
|
|
7260
|
-
getBounds() {
|
|
7259
|
+
getBounds(options) {
|
|
7261
7260
|
return this.wire
|
|
7262
|
-
.sendAction('get-window-bounds', this.identity)
|
|
7261
|
+
.sendAction('get-window-bounds', { ...this.identity, options })
|
|
7263
7262
|
.then(({ payload }) => payload.data);
|
|
7264
7263
|
}
|
|
7265
7264
|
/**
|
|
@@ -16215,7 +16214,7 @@ const layout_constants_1$1 = layout_constants;
|
|
|
16215
16214
|
*
|
|
16216
16215
|
* @remarks The built-in event emitter is not an OpenFin event emitter so it doesn't share propagation semantics.
|
|
16217
16216
|
*
|
|
16218
|
-
* ####
|
|
16217
|
+
* #### [addEventListener(type, listener [, options]);](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener)
|
|
16219
16218
|
* Adds a listener to the end of the listeners array for the specified event.
|
|
16220
16219
|
* @example
|
|
16221
16220
|
* ```js
|
|
@@ -16232,7 +16231,7 @@ const layout_constants_1$1 = layout_constants;
|
|
|
16232
16231
|
* });
|
|
16233
16232
|
* ```
|
|
16234
16233
|
*
|
|
16235
|
-
* ####
|
|
16234
|
+
* #### [removeEventListener(type, listener [, options]);](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener)
|
|
16236
16235
|
* Adds a listener to the end of the listeners array for the specified event.
|
|
16237
16236
|
* @example
|
|
16238
16237
|
* ```js
|
|
@@ -16583,7 +16582,7 @@ class Layout extends base_1$4.Base {
|
|
|
16583
16582
|
return layout_entities_1.LayoutNode.getEntity(stack, client);
|
|
16584
16583
|
}
|
|
16585
16584
|
/**
|
|
16586
|
-
* Adds a view to the platform layout. Behaves like @link
|
|
16585
|
+
* Adds a view to the platform layout. Behaves like {@link Platform#createView Platform.createView} with the current layout as the target.
|
|
16587
16586
|
*
|
|
16588
16587
|
* @param viewOptions - The options for creating the view.
|
|
16589
16588
|
* @param options - Optional parameters for adding the view.
|
|
@@ -16604,7 +16603,7 @@ class Layout extends base_1$4.Base {
|
|
|
16604
16603
|
}
|
|
16605
16604
|
/**
|
|
16606
16605
|
* Closes a view by its identity. Throws an error if the view does not belong to the current layout.
|
|
16607
|
-
* Behaves like @link
|
|
16606
|
+
* Behaves like {@link Platform#closeView Platform.closeView} but only closes the view if it belongs the current layout.
|
|
16608
16607
|
*
|
|
16609
16608
|
* @param viewIdentity - The identity of the view to close.
|
|
16610
16609
|
* @returns A promise that resolves when the view is closed.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfin/remote-adapter",
|
|
3
|
-
"version": "40.
|
|
3
|
+
"version": "40.102.2",
|
|
4
4
|
"description": "Establish intermachine runtime connections using webRTC.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"private": false,
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
"author": "OpenFin",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"lodash": "^4.17.21",
|
|
23
|
-
"@openfin/core": "40.
|
|
23
|
+
"@openfin/core": "40.102.2"
|
|
24
24
|
}
|
|
25
25
|
}
|