@openfin/fdc3-api 41.100.73 → 41.100.79

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.
@@ -4673,6 +4673,15 @@ declare class EmitterBase<EmitterEvent extends BaseEvent, EmitterEventType exten
4673
4673
  eventNames: () => (string | symbol)[];
4674
4674
  /* Excluded from this release type: emit */
4675
4675
  private hasEmitter;
4676
+ /**
4677
+ * Cleans up after removal of a listener, e.g. deleting any lingering deregistration handlers for a
4678
+ * `once` subscription.
4679
+ *
4680
+ * @remarks Implementing this as a `removeListener` handler ensures that direct removal of a listener
4681
+ * on the base emitter will not leak additional core handlers. We could do this in the forwarding method,
4682
+ * which would involve less "magic," but would be more-vulnerable to accidental re-introduction of a leak.
4683
+ */
4684
+ private cleanUpRemovedListener;
4676
4685
  private getOrCreateEmitter;
4677
4686
  listeners: (type: string | symbol) => Function[];
4678
4687
  listenerCount: (type: string | symbol) => number;
@@ -6096,6 +6105,30 @@ declare type FrameProcessDetails = ProcessDetails & {
6096
6105
  entityType: string;
6097
6106
  };
6098
6107
 
6108
+ /**
6109
+ * @interface
6110
+ * Options for the {@link Window._Window.getBounds} method.
6111
+ */
6112
+ declare interface GetBoundsOptions {
6113
+ /**
6114
+ * Specifies the state of the window for which to retrieve the bounds.
6115
+ *
6116
+ * - `'normal'`: Returns the bounds of the window in its 'normal' state (not maximized or minimized).
6117
+ * - `'current'`: Returns the bounds of the window in its current state. For a minimized window, this returns the bounds from its previous state before being minimized.
6118
+ *
6119
+ * If a window is in `normal` state, `current` and `normal` will return the same bounds.
6120
+ *
6121
+ * If a window is `maximized`, `current` will return the dimensions of the screen while `normal` will return the bounds the window will be restored to.
6122
+ *
6123
+ * If a window is `minimized`, both `current` and `normal` will return the bounds of the window prior to it being minimized.
6124
+ *
6125
+ * **Edge case:** On MacOS, if a window is maximized, then minimized, calling `getBounds` with `boundsType: 'current'` will return the bounds of the window when it was maximized while `normal` will return the normal bounds.
6126
+ *
6127
+ * @default 'normal'
6128
+ */
6129
+ boundsType?: 'normal' | 'current';
6130
+ }
6131
+
6099
6132
  /**
6100
6133
  * @interface
6101
6134
  */
@@ -9747,6 +9780,7 @@ declare namespace OpenFin {
9747
9780
  ScreenCapturePermission,
9748
9781
  Bounds,
9749
9782
  WindowBounds,
9783
+ GetBoundsOptions,
9750
9784
  Rectangle,
9751
9785
  ApplicationCreationOptions,
9752
9786
  TimeZones,
@@ -12467,7 +12501,9 @@ declare interface ProtocolMap extends ProtocolMapBase {
12467
12501
  options: OpenFin.TransitionOptions;
12468
12502
  }>;
12469
12503
  'get-all-frames': IdentityCall<{}, OpenFin.FrameInfo[]>;
12470
- 'get-window-bounds': IdentityCall<{}, OpenFin.WindowBounds>;
12504
+ 'get-window-bounds': IdentityCall<{
12505
+ options?: OpenFin.GetBoundsOptions;
12506
+ }, OpenFin.WindowBounds>;
12471
12507
  'center-window': IdentityCall;
12472
12508
  'blur-window': IdentityCall;
12473
12509
  'bring-window-to-front': IdentityCall;
@@ -18102,7 +18138,7 @@ declare class _Window extends WebContents<OpenFin.WindowEvent> {
18102
18138
  * getBounds().then(bounds => console.log(bounds)).catch(err => console.log(err));
18103
18139
  * ```
18104
18140
  */
18105
- getBounds(): Promise<OpenFin.WindowBounds>;
18141
+ getBounds(options?: OpenFin.GetBoundsOptions): Promise<OpenFin.WindowBounds>;
18106
18142
  /**
18107
18143
  * Centers the window on its current screen.
18108
18144
  *
@@ -4673,6 +4673,15 @@ declare class EmitterBase<EmitterEvent extends BaseEvent, EmitterEventType exten
4673
4673
  eventNames: () => (string | symbol)[];
4674
4674
  /* Excluded from this release type: emit */
4675
4675
  private hasEmitter;
4676
+ /**
4677
+ * Cleans up after removal of a listener, e.g. deleting any lingering deregistration handlers for a
4678
+ * `once` subscription.
4679
+ *
4680
+ * @remarks Implementing this as a `removeListener` handler ensures that direct removal of a listener
4681
+ * on the base emitter will not leak additional core handlers. We could do this in the forwarding method,
4682
+ * which would involve less "magic," but would be more-vulnerable to accidental re-introduction of a leak.
4683
+ */
4684
+ private cleanUpRemovedListener;
4676
4685
  private getOrCreateEmitter;
4677
4686
  listeners: (type: string | symbol) => Function[];
4678
4687
  listenerCount: (type: string | symbol) => number;
@@ -6096,6 +6105,30 @@ declare type FrameProcessDetails = ProcessDetails & {
6096
6105
  entityType: string;
6097
6106
  };
6098
6107
 
6108
+ /**
6109
+ * @interface
6110
+ * Options for the {@link Window._Window.getBounds} method.
6111
+ */
6112
+ declare interface GetBoundsOptions {
6113
+ /**
6114
+ * Specifies the state of the window for which to retrieve the bounds.
6115
+ *
6116
+ * - `'normal'`: Returns the bounds of the window in its 'normal' state (not maximized or minimized).
6117
+ * - `'current'`: Returns the bounds of the window in its current state. For a minimized window, this returns the bounds from its previous state before being minimized.
6118
+ *
6119
+ * If a window is in `normal` state, `current` and `normal` will return the same bounds.
6120
+ *
6121
+ * If a window is `maximized`, `current` will return the dimensions of the screen while `normal` will return the bounds the window will be restored to.
6122
+ *
6123
+ * If a window is `minimized`, both `current` and `normal` will return the bounds of the window prior to it being minimized.
6124
+ *
6125
+ * **Edge case:** On MacOS, if a window is maximized, then minimized, calling `getBounds` with `boundsType: 'current'` will return the bounds of the window when it was maximized while `normal` will return the normal bounds.
6126
+ *
6127
+ * @default 'normal'
6128
+ */
6129
+ boundsType?: 'normal' | 'current';
6130
+ }
6131
+
6099
6132
  /**
6100
6133
  * @interface
6101
6134
  */
@@ -9747,6 +9780,7 @@ declare namespace OpenFin {
9747
9780
  ScreenCapturePermission,
9748
9781
  Bounds,
9749
9782
  WindowBounds,
9783
+ GetBoundsOptions,
9750
9784
  Rectangle,
9751
9785
  ApplicationCreationOptions,
9752
9786
  TimeZones,
@@ -12467,7 +12501,9 @@ declare interface ProtocolMap extends ProtocolMapBase {
12467
12501
  options: OpenFin.TransitionOptions;
12468
12502
  }>;
12469
12503
  'get-all-frames': IdentityCall<{}, OpenFin.FrameInfo[]>;
12470
- 'get-window-bounds': IdentityCall<{}, OpenFin.WindowBounds>;
12504
+ 'get-window-bounds': IdentityCall<{
12505
+ options?: OpenFin.GetBoundsOptions;
12506
+ }, OpenFin.WindowBounds>;
12471
12507
  'center-window': IdentityCall;
12472
12508
  'blur-window': IdentityCall;
12473
12509
  'bring-window-to-front': IdentityCall;
@@ -18102,7 +18138,7 @@ declare class _Window extends WebContents<OpenFin.WindowEvent> {
18102
18138
  * getBounds().then(bounds => console.log(bounds)).catch(err => console.log(err));
18103
18139
  * ```
18104
18140
  */
18105
- getBounds(): Promise<OpenFin.WindowBounds>;
18141
+ getBounds(options?: OpenFin.GetBoundsOptions): Promise<OpenFin.WindowBounds>;
18106
18142
  /**
18107
18143
  * Centers the window on its current screen.
18108
18144
  *
@@ -4673,6 +4673,15 @@ declare class EmitterBase<EmitterEvent extends BaseEvent, EmitterEventType exten
4673
4673
  eventNames: () => (string | symbol)[];
4674
4674
  /* Excluded from this release type: emit */
4675
4675
  private hasEmitter;
4676
+ /**
4677
+ * Cleans up after removal of a listener, e.g. deleting any lingering deregistration handlers for a
4678
+ * `once` subscription.
4679
+ *
4680
+ * @remarks Implementing this as a `removeListener` handler ensures that direct removal of a listener
4681
+ * on the base emitter will not leak additional core handlers. We could do this in the forwarding method,
4682
+ * which would involve less "magic," but would be more-vulnerable to accidental re-introduction of a leak.
4683
+ */
4684
+ private cleanUpRemovedListener;
4676
4685
  private getOrCreateEmitter;
4677
4686
  listeners: (type: string | symbol) => Function[];
4678
4687
  listenerCount: (type: string | symbol) => number;
@@ -6096,6 +6105,30 @@ declare type FrameProcessDetails = ProcessDetails & {
6096
6105
  entityType: string;
6097
6106
  };
6098
6107
 
6108
+ /**
6109
+ * @interface
6110
+ * Options for the {@link Window._Window.getBounds} method.
6111
+ */
6112
+ declare interface GetBoundsOptions {
6113
+ /**
6114
+ * Specifies the state of the window for which to retrieve the bounds.
6115
+ *
6116
+ * - `'normal'`: Returns the bounds of the window in its 'normal' state (not maximized or minimized).
6117
+ * - `'current'`: Returns the bounds of the window in its current state. For a minimized window, this returns the bounds from its previous state before being minimized.
6118
+ *
6119
+ * If a window is in `normal` state, `current` and `normal` will return the same bounds.
6120
+ *
6121
+ * If a window is `maximized`, `current` will return the dimensions of the screen while `normal` will return the bounds the window will be restored to.
6122
+ *
6123
+ * If a window is `minimized`, both `current` and `normal` will return the bounds of the window prior to it being minimized.
6124
+ *
6125
+ * **Edge case:** On MacOS, if a window is maximized, then minimized, calling `getBounds` with `boundsType: 'current'` will return the bounds of the window when it was maximized while `normal` will return the normal bounds.
6126
+ *
6127
+ * @default 'normal'
6128
+ */
6129
+ boundsType?: 'normal' | 'current';
6130
+ }
6131
+
6099
6132
  /**
6100
6133
  * @interface
6101
6134
  */
@@ -9747,6 +9780,7 @@ declare namespace OpenFin {
9747
9780
  ScreenCapturePermission,
9748
9781
  Bounds,
9749
9782
  WindowBounds,
9783
+ GetBoundsOptions,
9750
9784
  Rectangle,
9751
9785
  ApplicationCreationOptions,
9752
9786
  TimeZones,
@@ -12467,7 +12501,9 @@ declare interface ProtocolMap extends ProtocolMapBase {
12467
12501
  options: OpenFin.TransitionOptions;
12468
12502
  }>;
12469
12503
  'get-all-frames': IdentityCall<{}, OpenFin.FrameInfo[]>;
12470
- 'get-window-bounds': IdentityCall<{}, OpenFin.WindowBounds>;
12504
+ 'get-window-bounds': IdentityCall<{
12505
+ options?: OpenFin.GetBoundsOptions;
12506
+ }, OpenFin.WindowBounds>;
12471
12507
  'center-window': IdentityCall;
12472
12508
  'blur-window': IdentityCall;
12473
12509
  'bring-window-to-front': IdentityCall;
@@ -18102,7 +18138,7 @@ declare class _Window extends WebContents<OpenFin.WindowEvent> {
18102
18138
  * getBounds().then(bounds => console.log(bounds)).catch(err => console.log(err));
18103
18139
  * ```
18104
18140
  */
18105
- getBounds(): Promise<OpenFin.WindowBounds>;
18141
+ getBounds(options?: OpenFin.GetBoundsOptions): Promise<OpenFin.WindowBounds>;
18106
18142
  /**
18107
18143
  * Centers the window on its current screen.
18108
18144
  *
package/out/fdc3-api.d.ts CHANGED
@@ -4737,6 +4737,15 @@ declare class EmitterBase<EmitterEvent extends BaseEvent, EmitterEventType exten
4737
4737
  type: EventType;
4738
4738
  }>, ...args: any[]) => boolean;
4739
4739
  private hasEmitter;
4740
+ /**
4741
+ * Cleans up after removal of a listener, e.g. deleting any lingering deregistration handlers for a
4742
+ * `once` subscription.
4743
+ *
4744
+ * @remarks Implementing this as a `removeListener` handler ensures that direct removal of a listener
4745
+ * on the base emitter will not leak additional core handlers. We could do this in the forwarding method,
4746
+ * which would involve less "magic," but would be more-vulnerable to accidental re-introduction of a leak.
4747
+ */
4748
+ private cleanUpRemovedListener;
4740
4749
  private getOrCreateEmitter;
4741
4750
  listeners: (type: string | symbol) => Function[];
4742
4751
  listenerCount: (type: string | symbol) => number;
@@ -6184,6 +6193,30 @@ declare type FrameProcessDetails = ProcessDetails & {
6184
6193
  entityType: string;
6185
6194
  };
6186
6195
 
6196
+ /**
6197
+ * @interface
6198
+ * Options for the {@link Window._Window.getBounds} method.
6199
+ */
6200
+ declare interface GetBoundsOptions {
6201
+ /**
6202
+ * Specifies the state of the window for which to retrieve the bounds.
6203
+ *
6204
+ * - `'normal'`: Returns the bounds of the window in its 'normal' state (not maximized or minimized).
6205
+ * - `'current'`: Returns the bounds of the window in its current state. For a minimized window, this returns the bounds from its previous state before being minimized.
6206
+ *
6207
+ * If a window is in `normal` state, `current` and `normal` will return the same bounds.
6208
+ *
6209
+ * If a window is `maximized`, `current` will return the dimensions of the screen while `normal` will return the bounds the window will be restored to.
6210
+ *
6211
+ * If a window is `minimized`, both `current` and `normal` will return the bounds of the window prior to it being minimized.
6212
+ *
6213
+ * **Edge case:** On MacOS, if a window is maximized, then minimized, calling `getBounds` with `boundsType: 'current'` will return the bounds of the window when it was maximized while `normal` will return the normal bounds.
6214
+ *
6215
+ * @default 'normal'
6216
+ */
6217
+ boundsType?: 'normal' | 'current';
6218
+ }
6219
+
6187
6220
  /**
6188
6221
  * @interface
6189
6222
  */
@@ -10065,6 +10098,7 @@ declare namespace OpenFin {
10065
10098
  ScreenCapturePermission,
10066
10099
  Bounds,
10067
10100
  WindowBounds,
10101
+ GetBoundsOptions,
10068
10102
  Rectangle,
10069
10103
  ApplicationCreationOptions,
10070
10104
  TimeZones,
@@ -12868,7 +12902,9 @@ declare interface ProtocolMap extends ProtocolMapBase {
12868
12902
  options: OpenFin.TransitionOptions;
12869
12903
  }>;
12870
12904
  'get-all-frames': IdentityCall<{}, OpenFin.FrameInfo[]>;
12871
- 'get-window-bounds': IdentityCall<{}, OpenFin.WindowBounds>;
12905
+ 'get-window-bounds': IdentityCall<{
12906
+ options?: OpenFin.GetBoundsOptions;
12907
+ }, OpenFin.WindowBounds>;
12872
12908
  'center-window': IdentityCall;
12873
12909
  'blur-window': IdentityCall;
12874
12910
  'bring-window-to-front': IdentityCall;
@@ -18556,7 +18592,7 @@ declare class _Window extends WebContents<OpenFin.WindowEvent> {
18556
18592
  * getBounds().then(bounds => console.log(bounds)).catch(err => console.log(err));
18557
18593
  * ```
18558
18594
  */
18559
- getBounds(): Promise<OpenFin.WindowBounds>;
18595
+ getBounds(options?: OpenFin.GetBoundsOptions): Promise<OpenFin.WindowBounds>;
18560
18596
  /**
18561
18597
  * Centers the window on its current screen.
18562
18598
  *
package/out/fdc3-api.js CHANGED
@@ -489,7 +489,7 @@ var __classPrivateFieldGet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateF
489
489
  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");
490
490
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
491
491
  };
492
- var _EmitterBase_emitterAccessor;
492
+ var _EmitterBase_emitterAccessor, _EmitterBase_deregisterOnceListeners;
493
493
  Object.defineProperty(base, "__esModule", { value: true });
494
494
  base.Reply = base.EmitterBase = base.Base = void 0;
495
495
  const promises_1 = promises;
@@ -561,6 +561,7 @@ class EmitterBase extends Base {
561
561
  super(wire);
562
562
  this.topic = topic;
563
563
  _EmitterBase_emitterAccessor.set(this, void 0);
564
+ _EmitterBase_deregisterOnceListeners.set(this, void 0);
564
565
  this.eventNames = () => (this.hasEmitter() ? this.getOrCreateEmitter().eventNames() : []);
565
566
  /**
566
567
  * @internal
@@ -569,7 +570,28 @@ class EmitterBase extends Base {
569
570
  return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
570
571
  };
571
572
  this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$3(this, _EmitterBase_emitterAccessor, "f"));
572
- this.getOrCreateEmitter = () => this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$3(this, _EmitterBase_emitterAccessor, "f"));
573
+ /**
574
+ * Cleans up after removal of a listener, e.g. deleting any lingering deregistration handlers for a
575
+ * `once` subscription.
576
+ *
577
+ * @remarks Implementing this as a `removeListener` handler ensures that direct removal of a listener
578
+ * on the base emitter will not leak additional core handlers. We could do this in the forwarding method,
579
+ * which would involve less "magic," but would be more-vulnerable to accidental re-introduction of a leak.
580
+ */
581
+ this.cleanUpRemovedListener = (eventType, listener) => {
582
+ const deregister = __classPrivateFieldGet$3(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
583
+ if (deregister) {
584
+ const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$3(this, _EmitterBase_emitterAccessor, "f"));
585
+ emitter.removeListener(eventType, deregister);
586
+ }
587
+ };
588
+ this.getOrCreateEmitter = () => {
589
+ const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$3(this, _EmitterBase_emitterAccessor, "f"));
590
+ if (!emitter.listeners('removeListener').includes(this.cleanUpRemovedListener)) {
591
+ emitter.on('removeListener', this.cleanUpRemovedListener);
592
+ }
593
+ return emitter;
594
+ };
573
595
  this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
574
596
  this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
575
597
  this.registerEventListener = async (eventType, options = {}, applySubscription, undoSubscription) => {
@@ -601,13 +623,13 @@ class EmitterBase extends Base {
601
623
  type: eventType
602
624
  };
603
625
  await this.wire.sendAction('unsubscribe-to-desktop-event', runtimeEvent).catch(() => null);
604
- const emitter = this.getOrCreateEmitter();
605
- return emitter;
626
+ return this.getOrCreateEmitter();
606
627
  }
607
628
  // This will only be reached if unsubscribe from event that does not exist but do not want to error here
608
629
  return Promise.resolve();
609
630
  };
610
631
  __classPrivateFieldSet$3(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
632
+ __classPrivateFieldSet$3(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
611
633
  this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
612
634
  }
613
635
  /**
@@ -636,6 +658,7 @@ class EmitterBase extends Base {
636
658
  */
637
659
  async once(eventType, listener, options) {
638
660
  const deregister = () => this.deregisterEventListener(eventType);
661
+ __classPrivateFieldGet$3(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
639
662
  await this.registerEventListener(eventType, options, (emitter) => {
640
663
  emitter.once(eventType, deregister);
641
664
  emitter.once(eventType, listener);
@@ -666,6 +689,7 @@ class EmitterBase extends Base {
666
689
  */
667
690
  async prependOnceListener(eventType, listener, options) {
668
691
  const deregister = () => this.deregisterEventListener(eventType);
692
+ __classPrivateFieldGet$3(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
669
693
  await this.registerEventListener(eventType, options, (emitter) => {
670
694
  emitter.prependOnceListener(eventType, listener);
671
695
  emitter.once(eventType, deregister);
@@ -724,13 +748,13 @@ class EmitterBase extends Base {
724
748
  return this;
725
749
  }
726
750
  deleteEmitterIfNothingRegistered(emitter) {
727
- if (emitter.eventNames().length === 0) {
751
+ if (emitter.eventNames().every((type) => type === 'removeListener')) {
728
752
  this.wire.eventAggregator.delete(__classPrivateFieldGet$3(this, _EmitterBase_emitterAccessor, "f"));
729
753
  }
730
754
  }
731
755
  }
732
756
  base.EmitterBase = EmitterBase;
733
- _EmitterBase_emitterAccessor = new WeakMap();
757
+ _EmitterBase_emitterAccessor = new WeakMap(), _EmitterBase_deregisterOnceListeners = new WeakMap();
734
758
  class Reply {
735
759
  }
736
760
  base.Reply = Reply;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/fdc3-api",
3
- "version": "41.100.73",
3
+ "version": "41.100.79",
4
4
  "description": "OpenFin fdc3 module utilities and types.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "private": false,