@supraio/client-daemon-js 0.0.1-mz-plain-js.1 → 0.0.1-mz-warmup.0

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/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@supraio/client-daemon-js",
3
- "version": "0.0.1-mz-plain-js.1",
3
+ "version": "0.0.1-mz-warmup.0",
4
4
  "description": "",
5
- "main": "daemon.js",
5
+ "main": "sdk.js",
6
6
  "scripts": {
7
7
  "build-daemon": "esbuild --bundle --sourcemap --target=chrome88,firefox86,edge89 --outfile=dist/daemon.js daemon.ts",
8
8
  "build-screen": "esbuild --bundle --sourcemap --target=chrome88,firefox86,edge89 --outfile=dist/screen.js screen.ts",
9
+ "build-sdk": "esbuild --bundle --sourcemap --target=chrome88,firefox86,edge89 --outfile=dist/sdk.js sdk.ts",
9
10
  "check": "tsc --noEmit",
10
11
  "lint": "eslint \"**/*.ts\""
11
12
  },
package/screen.js CHANGED
@@ -17432,15 +17432,15 @@
17432
17432
  // screen/wasm.ts
17433
17433
  var SCREEN_WASM_URL = "supra-client-screen.wasm";
17434
17434
  var WASM_EXEC_URL = "wasm_exec.js";
17435
- async function startWasmScreen() {
17436
- const options = parseQueryOptions();
17435
+ async function startWasmScreen(options) {
17436
+ const screenOptions = options ?? parseQueryOptions();
17437
17437
  const fs = await initBrowserFS();
17438
17438
  const h264Decoder = await createH264Decoder();
17439
17439
  window.h264Decoder = h264Decoder;
17440
17440
  window.fs = fs;
17441
17441
  window.module = {};
17442
17442
  await injectScript(WASM_EXEC_URL);
17443
- await startGoScreen(h264Decoder, options);
17443
+ await startGoScreen(h264Decoder, screenOptions);
17444
17444
  }
17445
17445
  function parseQueryOptions() {
17446
17446
  const params = import_querystring.default.parse(window.location.search.substr(1));
@@ -17497,6 +17497,15 @@
17497
17497
  ];
17498
17498
  }
17499
17499
 
17500
+ // sdk.ts
17501
+ async function startScreen(options) {
17502
+ if (localStorage.getItem(FORCE_PLAIN_KEY) || window.WebAssembly === void 0) {
17503
+ await startPlainScreen();
17504
+ } else {
17505
+ await startWasmScreen(options);
17506
+ }
17507
+ }
17508
+
17500
17509
  // screen.ts
17501
17510
  window.addEventListener("contextmenu", (ev) => ev.preventDefault());
17502
17511
  window.addEventListener("beforeunload", (ev) => {
@@ -17504,11 +17513,7 @@
17504
17513
  });
17505
17514
  window.addEventListener("load", async () => {
17506
17515
  try {
17507
- if (localStorage.getItem(FORCE_PLAIN_KEY) || window.WebAssembly === void 0) {
17508
- await startPlainScreen();
17509
- } else {
17510
- await startWasmScreen();
17511
- }
17516
+ await startScreen();
17512
17517
  } finally {
17513
17518
  console.error("Reloading window");
17514
17519
  location.reload();