@inweb/viewer-visualize 26.2.1 → 26.2.3

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.
@@ -17575,11 +17575,12 @@
17575
17575
  // By use of this software, its documentation or related materials, you
17576
17576
  // acknowledge and accept the above terms.
17577
17577
  ///////////////////////////////////////////////////////////////////////////////
17578
- function loadScript(url) {
17578
+ function loadScript(url, params = {}) {
17579
17579
  return new Promise((resolve, reject) => {
17580
17580
  const script = document.createElement("script");
17581
17581
  script.src = url;
17582
17582
  script.async = true;
17583
+ script.crossOrigin = params.crossOrigin;
17583
17584
  script.onload = () => resolve(script);
17584
17585
  script.onerror = () => {
17585
17586
  script.remove();
@@ -17588,7 +17589,7 @@
17588
17589
  document.body.appendChild(script);
17589
17590
  });
17590
17591
  }
17591
- function loadVisuazlizeJsScript(url) {
17592
+ function loadVisuazlizeJsScript(url, params) {
17592
17593
  if (window["getVisualizeLibInst"]) {
17593
17594
  const script = window["getVisualizeLibInst"].script;
17594
17595
  if (script) {
@@ -17598,21 +17599,21 @@
17598
17599
  }
17599
17600
  delete window["getVisualizeLibInst"];
17600
17601
  }
17601
- return loadScript(url);
17602
+ return loadScript(url, params);
17602
17603
  }
17603
- const loadVisualizeJs = (url, onprogress) => {
17604
- return loadVisuazlizeJsScript(url).then((script) => {
17605
- return new Promise((resolve, reject) => {
17606
- const instance = window["getVisualizeLibInst"]({
17607
- urlMemFile: url + ".wasm",
17608
- TOTAL_MEMORY: 134217728,
17609
- onprogress,
17610
- });
17611
- instance["loadWasmError"] = reject;
17612
- instance.postRun.push(() => {
17613
- window["getVisualizeLibInst"].script = script;
17614
- resolve(instance);
17615
- });
17604
+ const loadVisualizeJs = async (url, onprogress, params = {}) => {
17605
+ const script = await loadVisuazlizeJsScript(url, params);
17606
+ return await new Promise((resolve, reject) => {
17607
+ const options = {
17608
+ urlMemFile: url + ".wasm",
17609
+ TOTAL_MEMORY: 134217728,
17610
+ onprogress,
17611
+ };
17612
+ const instance = window["getVisualizeLibInst"](options);
17613
+ instance.loadWasmError = reject;
17614
+ instance.postRun.push(() => {
17615
+ window["getVisualizeLibInst"].script = script;
17616
+ resolve(instance);
17616
17617
  });
17617
17618
  });
17618
17619
  };
@@ -18461,6 +18462,10 @@
18461
18462
  * @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own library
18462
18463
  * instance, or specify `undefined` or blank to use the default URL defined by `Viewer.visualize`
18463
18464
  * library you are using.
18465
+ * @param params.crossOrigin - The
18466
+ * {@link https://developer.mozilla.org/docs/Web/HTML/Attributes/crossorigin | crossorigin} content
18467
+ * attribute on `Visalize.js` script element. One of the following values: `""`, `anonymous` or
18468
+ * `use-credentials`.
18464
18469
  * @param params.enableAutoUpdate - Enable auto-update of the viewer after any changes. If the
18465
18470
  * auto-update is disabled, you need to register an `update` event handler and update the
18466
18471
  * `VisualizeJS` viewer and active dragger manually. Default is `true`.
@@ -18515,9 +18520,14 @@
18515
18520
  * @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own library
18516
18521
  * instance or specify `undefined` or blank to use the default URL defined by `Viewer.visualize`
18517
18522
  * library you are using.
18523
+ * @param params.crossOrigin - The
18524
+ * {@link https://developer.mozilla.org/docs/Web/HTML/Attributes/crossorigin | crossorigin} content
18525
+ * attribute on `Visalize.js` script element. One of the following values: `""`, `anonymous` or
18526
+ * `use-credentials`.
18518
18527
  */
18519
18528
  configure(params) {
18520
- this._visualizeJsUrl = params.visualizeJsUrl || "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/master/Visualize.js";
18529
+ this._visualizeJsUrl = params.visualizeJsUrl || "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/26.2/Visualize.js";
18530
+ this._crossOrigin = params.crossOrigin;
18521
18531
  return this;
18522
18532
  }
18523
18533
  /**
@@ -18552,7 +18562,7 @@
18552
18562
  if (onProgress)
18553
18563
  onProgress(new ProgressEvent("progress", { lengthComputable: true, loaded, total }));
18554
18564
  this.emitEvent({ type: "initializeprogress", data: loaded / total, loaded, total });
18555
- });
18565
+ }, { crossOrigin: this._crossOrigin });
18556
18566
  if (visualizeTimestamp !== this._visualizeTimestamp)
18557
18567
  throw new Error("Viewer error: dispose() was called before initialize() completed. Are you using React strict mode?");
18558
18568
  this._visualizeJs = visualizeJs;