@openfin/core 47.100.1 → 47.100.4

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.
@@ -1997,6 +1997,8 @@ declare type BeginUserBoundsChangingEvent = UserBoundsChangeEvent & {
1997
1997
  type: 'begin-user-bounds-changing';
1998
1998
  };
1999
1999
 
2000
+ declare type BFCacheRestoreListener = () => void | Promise<void>;
2001
+
2000
2002
  /**
2001
2003
  * A rule prescribing content creation that should be blocked.
2002
2004
  *
@@ -5384,6 +5386,16 @@ declare interface Environment {
5384
5386
  resolveLayout(layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>, layoutIdentity: OpenFin_2.LayoutIdentity): Promise<any>;
5385
5387
  initPlatform(fin: OpenFin_2.Fin<OpenFin_2.EntityType>, ...args: Parameters<OpenFin_2.Fin['Platform']['init']>): ReturnType<OpenFin_2.Fin['Platform']['init']>;
5386
5388
  observeBounds(element: Element, onChange: (bounds: DOMRect) => Promise<void> | void): () => void;
5389
+ /**
5390
+ * Registers a listener invoked when the current page has been restored from the
5391
+ * browser's back/forward cache. Stateful APIs (e.g. channels) use this to re-establish
5392
+ * connections that were torn down while the page was cached.
5393
+ *
5394
+ * No-op in environments that cannot be bfcached.
5395
+ *
5396
+ * @returns a function that unregisters the listener.
5397
+ */
5398
+ onBFCacheRestore(listener: BFCacheRestoreListener): () => void;
5387
5399
  writeToken(path: string, token: string): Promise<string>;
5388
5400
  retrievePort(config: NewConnectConfig): Promise<number>;
5389
5401
  getNextMessageId(): any;
@@ -1997,6 +1997,8 @@ declare type BeginUserBoundsChangingEvent = UserBoundsChangeEvent & {
1997
1997
  type: 'begin-user-bounds-changing';
1998
1998
  };
1999
1999
 
2000
+ declare type BFCacheRestoreListener = () => void | Promise<void>;
2001
+
2000
2002
  /**
2001
2003
  * A rule prescribing content creation that should be blocked.
2002
2004
  *
@@ -5384,6 +5386,16 @@ declare interface Environment {
5384
5386
  resolveLayout(layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>, layoutIdentity: OpenFin_2.LayoutIdentity): Promise<any>;
5385
5387
  initPlatform(fin: OpenFin_2.Fin<OpenFin_2.EntityType>, ...args: Parameters<OpenFin_2.Fin['Platform']['init']>): ReturnType<OpenFin_2.Fin['Platform']['init']>;
5386
5388
  observeBounds(element: Element, onChange: (bounds: DOMRect) => Promise<void> | void): () => void;
5389
+ /**
5390
+ * Registers a listener invoked when the current page has been restored from the
5391
+ * browser's back/forward cache. Stateful APIs (e.g. channels) use this to re-establish
5392
+ * connections that were torn down while the page was cached.
5393
+ *
5394
+ * No-op in environments that cannot be bfcached.
5395
+ *
5396
+ * @returns a function that unregisters the listener.
5397
+ */
5398
+ onBFCacheRestore(listener: BFCacheRestoreListener): () => void;
5387
5399
  writeToken(path: string, token: string): Promise<string>;
5388
5400
  retrievePort(config: NewConnectConfig): Promise<number>;
5389
5401
  getNextMessageId(): any;
@@ -1997,6 +1997,8 @@ declare type BeginUserBoundsChangingEvent = UserBoundsChangeEvent & {
1997
1997
  type: 'begin-user-bounds-changing';
1998
1998
  };
1999
1999
 
2000
+ declare type BFCacheRestoreListener = () => void | Promise<void>;
2001
+
2000
2002
  /**
2001
2003
  * A rule prescribing content creation that should be blocked.
2002
2004
  *
@@ -5384,6 +5386,16 @@ declare interface Environment {
5384
5386
  resolveLayout(layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>, layoutIdentity: OpenFin_2.LayoutIdentity): Promise<any>;
5385
5387
  initPlatform(fin: OpenFin_2.Fin<OpenFin_2.EntityType>, ...args: Parameters<OpenFin_2.Fin['Platform']['init']>): ReturnType<OpenFin_2.Fin['Platform']['init']>;
5386
5388
  observeBounds(element: Element, onChange: (bounds: DOMRect) => Promise<void> | void): () => void;
5389
+ /**
5390
+ * Registers a listener invoked when the current page has been restored from the
5391
+ * browser's back/forward cache. Stateful APIs (e.g. channels) use this to re-establish
5392
+ * connections that were torn down while the page was cached.
5393
+ *
5394
+ * No-op in environments that cannot be bfcached.
5395
+ *
5396
+ * @returns a function that unregisters the listener.
5397
+ */
5398
+ onBFCacheRestore(listener: BFCacheRestoreListener): () => void;
5387
5399
  writeToken(path: string, token: string): Promise<string>;
5388
5400
  retrievePort(config: NewConnectConfig): Promise<number>;
5389
5401
  getNextMessageId(): any;
package/out/stub.d.ts CHANGED
@@ -2030,6 +2030,8 @@ declare type BeginUserBoundsChangingEvent = UserBoundsChangeEvent & {
2030
2030
  type: 'begin-user-bounds-changing';
2031
2031
  };
2032
2032
 
2033
+ declare type BFCacheRestoreListener = () => void | Promise<void>;
2034
+
2033
2035
  /**
2034
2036
  * A rule prescribing content creation that should be blocked.
2035
2037
  *
@@ -5496,6 +5498,16 @@ declare interface Environment {
5496
5498
  resolveLayout(layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>, layoutIdentity: OpenFin_2.LayoutIdentity): Promise<any>;
5497
5499
  initPlatform(fin: OpenFin_2.Fin<OpenFin_2.EntityType>, ...args: Parameters<OpenFin_2.Fin['Platform']['init']>): ReturnType<OpenFin_2.Fin['Platform']['init']>;
5498
5500
  observeBounds(element: Element, onChange: (bounds: DOMRect) => Promise<void> | void): () => void;
5501
+ /**
5502
+ * Registers a listener invoked when the current page has been restored from the
5503
+ * browser's back/forward cache. Stateful APIs (e.g. channels) use this to re-establish
5504
+ * connections that were torn down while the page was cached.
5505
+ *
5506
+ * No-op in environments that cannot be bfcached.
5507
+ *
5508
+ * @returns a function that unregisters the listener.
5509
+ */
5510
+ onBFCacheRestore(listener: BFCacheRestoreListener): () => void;
5499
5511
  writeToken(path: string, token: string): Promise<string>;
5500
5512
  retrievePort(config: NewConnectConfig): Promise<number>;
5501
5513
  getNextMessageId(): any;
package/out/stub.js CHANGED
@@ -17134,6 +17134,15 @@ class Transport extends events.EventEmitter {
17134
17134
  const { uuid, name } = config;
17135
17135
  const entityType = this.environment.getCurrentEntityType();
17136
17136
  this.me = getBaseMe(entityType, uuid, name);
17137
+ // Registered here rather than per-caller so that a restoration is logged exactly once,
17138
+ // however many parts of the adapter go on to subscribe.
17139
+ this.environment.onBFCacheRestore(async () => {
17140
+ await this.sendAction('write-to-log', {
17141
+ level: 'verbose',
17142
+ message: `Page restored from the back/forward cache for ${uuid}/${name}`,
17143
+ target: {}
17144
+ });
17145
+ });
17137
17146
  }
17138
17147
  getFin() {
17139
17148
  if (!__classPrivateFieldGet(this, _Transport_fin, "f")) {
@@ -17376,6 +17385,11 @@ class StubEnvironment {
17376
17385
  observeBounds() {
17377
17386
  throw new Error(environmentUnsupportedMessage);
17378
17387
  }
17388
+ onBFCacheRestore(listener) {
17389
+ // Deliberately not throwing: callers register unconditionally, including from the
17390
+ // Transport constructor, which the stub environment has to survive.
17391
+ return () => undefined;
17392
+ }
17379
17393
  writeToken(path, token) {
17380
17394
  throw new Error(environmentUnsupportedMessage);
17381
17395
  }
package/out/stub.mjs CHANGED
@@ -17092,6 +17092,15 @@ class Transport extends EventEmitter {
17092
17092
  const { uuid, name } = config;
17093
17093
  const entityType = this.environment.getCurrentEntityType();
17094
17094
  this.me = getBaseMe(entityType, uuid, name);
17095
+ // Registered here rather than per-caller so that a restoration is logged exactly once,
17096
+ // however many parts of the adapter go on to subscribe.
17097
+ this.environment.onBFCacheRestore(async () => {
17098
+ await this.sendAction('write-to-log', {
17099
+ level: 'verbose',
17100
+ message: `Page restored from the back/forward cache for ${uuid}/${name}`,
17101
+ target: {}
17102
+ });
17103
+ });
17095
17104
  }
17096
17105
  getFin() {
17097
17106
  if (!__classPrivateFieldGet(this, _Transport_fin, "f")) {
@@ -17334,6 +17343,11 @@ class StubEnvironment {
17334
17343
  observeBounds() {
17335
17344
  throw new Error(environmentUnsupportedMessage);
17336
17345
  }
17346
+ onBFCacheRestore(listener) {
17347
+ // Deliberately not throwing: callers register unconditionally, including from the
17348
+ // Transport constructor, which the stub environment has to survive.
17349
+ return () => undefined;
17350
+ }
17337
17351
  writeToken(path, token) {
17338
17352
  throw new Error(environmentUnsupportedMessage);
17339
17353
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/core",
3
- "version": "47.100.1",
3
+ "version": "47.100.4",
4
4
  "description": "The core renderer entry point of OpenFin",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "main": "out/stub.js",