@thatopen/components 3.4.1 → 3.4.2

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/dist/index.cjs CHANGED
@@ -7484,6 +7484,20 @@ const _FragmentsManager = class _FragmentsManager extends Component {
7484
7484
  __publicField(this, "_core");
7485
7485
  this.components.add(_FragmentsManager.uuid, this);
7486
7486
  }
7487
+ /**
7488
+ * Returns a blob URL for the fragments worker matching the installed
7489
+ * `@thatopen/fragments` version. Delegates to {@link FRAGS.FragmentsModels.getWorker}.
7490
+ * This is the recommended way to obtain the URL passed to {@link FragmentsManager.init}.
7491
+ *
7492
+ * @example
7493
+ * ```ts
7494
+ * const fragments = components.get(OBC.FragmentsManager);
7495
+ * fragments.init(await OBC.FragmentsManager.getWorker());
7496
+ * ```
7497
+ */
7498
+ static getWorker() {
7499
+ return FRAGS.FragmentsModels.getWorker();
7500
+ }
7487
7501
  get initialized() {
7488
7502
  return !!this._core;
7489
7503
  }
@@ -7515,6 +7529,13 @@ const _FragmentsManager = class _FragmentsManager extends Component {
7515
7529
  this.onDisposed.trigger();
7516
7530
  this.onDisposed.reset();
7517
7531
  }
7532
+ /**
7533
+ * Initializes the fragments core with the given worker URL.
7534
+ * The recommended way to obtain the URL is {@link FragmentsManager.getWorker}:
7535
+ * ```ts
7536
+ * fragments.init(await OBC.FragmentsManager.getWorker());
7537
+ * ```
7538
+ */
7518
7539
  init(workerURL, options) {
7519
7540
  this._core = new FRAGS.FragmentsModels(workerURL, options);
7520
7541
  this.core.onModelLoaded.add(async () => {
package/dist/index.d.ts CHANGED
@@ -3125,9 +3125,21 @@ export declare class FirstPersonMode implements NavigationMode {
3125
3125
  export declare function formatSlope(slope: number, format: SlopeFormat): string;
3126
3126
 
3127
3127
  /**
3128
- * Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager).
3128
+ * Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager). Before calling {@link FragmentsManager.init}, you need a URL for the fragments worker. The recommended way to get it is {@link FragmentsManager.getWorker}, which fetches the version-matched worker from unpkg.
3129
3129
  */
3130
3130
  export declare class FragmentsManager extends Component implements Disposable_2 {
3131
+ /**
3132
+ * Returns a blob URL for the fragments worker matching the installed
3133
+ * `@thatopen/fragments` version. Delegates to {@link FRAGS.FragmentsModels.getWorker}.
3134
+ * This is the recommended way to obtain the URL passed to {@link FragmentsManager.init}.
3135
+ *
3136
+ * @example
3137
+ * ```ts
3138
+ * const fragments = components.get(OBC.FragmentsManager);
3139
+ * fragments.init(await OBC.FragmentsManager.getWorker());
3140
+ * ```
3141
+ */
3142
+ static getWorker(): Promise<string>;
3131
3143
  /**
3132
3144
  * A unique identifier for the component.
3133
3145
  * This UUID is used to register the component within the Components system.
@@ -3156,6 +3168,13 @@ export declare class FragmentsManager extends Component implements Disposable_2
3156
3168
  constructor(components: Components);
3157
3169
  /** {@link Disposable.dispose} */
3158
3170
  dispose(): void;
3171
+ /**
3172
+ * Initializes the fragments core with the given worker URL.
3173
+ * The recommended way to obtain the URL is {@link FragmentsManager.getWorker}:
3174
+ * ```ts
3175
+ * fragments.init(await OBC.FragmentsManager.getWorker());
3176
+ * ```
3177
+ */
3159
3178
  init(workerURL: string, options?: {
3160
3179
  classicWorker?: boolean;
3161
3180
  }): void;