@telepath-computer/television-desktop 0.1.169 → 0.1.170

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.
@@ -22,6 +22,45 @@ if (process.contextIsolated) {
22
22
  } else {
23
23
  window.__televisionContentBridge = contentBridge;
24
24
  }
25
+ var GUID_RADIX = 36;
26
+ var GUID_WORD_COUNT = 4;
27
+ function makeBridgeGuid() {
28
+ const now = Date.now().toString(GUID_RADIX);
29
+ try {
30
+ const cryptoLike = window.crypto;
31
+ if (cryptoLike && typeof cryptoLike.getRandomValues === "function") {
32
+ const values = new Uint32Array(GUID_WORD_COUNT);
33
+ cryptoLike.getRandomValues(values);
34
+ return `tvb-${now}-${Array.from(values, (value) => value.toString(GUID_RADIX)).join("-")}`;
35
+ }
36
+ } catch {
37
+ }
38
+ return `tvb-${now}-${Math.random().toString(GUID_RADIX).slice(2)}-${Math.random().toString(GUID_RADIX).slice(2)}`;
39
+ }
40
+ var documentGuid = makeBridgeGuid();
41
+ function postBridgeReady() {
42
+ import_electron.ipcRenderer.sendToHost(BRIDGE_CHANNEL, {
43
+ type: "bridge-ready",
44
+ url: window.location.href,
45
+ guid: documentGuid
46
+ });
47
+ }
48
+ function postInitialBridgeReady() {
49
+ if (document.readyState === "complete") {
50
+ postBridgeReady();
51
+ return;
52
+ }
53
+ window.addEventListener("load", postBridgeReady, { once: true });
54
+ }
55
+ window.addEventListener("pagehide", () => {
56
+ import_electron.ipcRenderer.sendToHost(BRIDGE_CHANNEL, { type: "leaving", guid: documentGuid });
57
+ });
58
+ window.addEventListener("pageshow", (event) => {
59
+ if (event.persisted === true) {
60
+ postBridgeReady();
61
+ }
62
+ });
63
+ postInitialBridgeReady();
25
64
  function startProxyContentPoll() {
26
65
  const capturedURL = window.location.href;
27
66
  const isTvArtifactURL = (url) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@telepath-computer/television-desktop",
3
3
  "productName": "Television",
4
- "version": "0.1.169",
4
+ "version": "0.1.170",
5
5
  "type": "module",
6
6
  "main": "dist/electron.cjs",
7
7
  "bin": {