@cognite/reveal 4.28.5-dev.20251203 → 4.28.5-dev.20251204

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.
@@ -30,7 +30,6 @@ export declare class RevealManager {
30
30
  private _isDisposed;
31
31
  private readonly _subscriptions;
32
32
  private readonly _events;
33
- private readonly _updateSubject;
34
33
  private readonly _cameraManager;
35
34
  private readonly _onCameraChange;
36
35
  private readonly _onCameraStop;
@@ -62,6 +61,5 @@ export declare class RevealManager {
62
61
  addModel<T extends DataSourceType>(type: 'pointcloud', modelIdentifier: AddModelOptionsWithModelRevisionId<T>): Promise<PointCloudNode<T>>;
63
62
  removeModel(type: 'cad', model: CadNode): void;
64
63
  removeModel(type: 'pointcloud', model: PointCloudNode): void;
65
- private notifyLoadingStateChanged;
66
64
  private initLoadingStateObserver;
67
65
  }
@@ -27,6 +27,7 @@ import { Image360Action } from '../../../../360-images/src/Image360Action';
27
27
  export declare class Cognite3DViewer<DataSourceT extends DataSourceType = ClassicDataSourceType> {
28
28
  private readonly _domElementResizeObserver;
29
29
  private readonly _image360ApiHelper;
30
+ private readonly _unsubsribeOnLoading;
30
31
  /**
31
32
  * Returns the rendering canvas, the DOM element where the renderer draws its output.
32
33
  */
@@ -50,7 +51,6 @@ export declare class Cognite3DViewer<DataSourceT extends DataSourceType = Classi
50
51
  private readonly _dataSource;
51
52
  private readonly _sceneHandler;
52
53
  private readonly _activeCameraManager;
53
- private readonly _subscription;
54
54
  private readonly _revealManagerHelper;
55
55
  private readonly _domElement;
56
56
  private readonly _renderer;
@@ -2,7 +2,6 @@
2
2
  * Copyright 2021 Cognite AS
3
3
  */
4
4
  import * as THREE from 'three';
5
- import { Observable } from 'rxjs';
6
5
  import { CadModelMetadata } from '../../cad-parsers';
7
6
  import { CadModelUpdateHandler } from './CadModelUpdateHandler';
8
7
  import { LoadingState } from '../../model-base';
@@ -15,9 +14,10 @@ export declare class CadManager {
15
14
  private readonly _cadModelFactory;
16
15
  private readonly _cadModelUpdateHandler;
17
16
  private readonly _cadModelMap;
18
- private readonly _subscription;
17
+ private readonly _unsubscribeConsumedSectors;
19
18
  private _compatibleFileFormat;
20
19
  private _needsRedraw;
20
+ private readonly _loadingStateChangedTrigger;
21
21
  private readonly _markNeedsRedrawBound;
22
22
  private readonly _materialsChangedListener;
23
23
  private readonly _sectorBufferTime;
@@ -42,7 +42,8 @@ export declare class CadManager {
42
42
  updateModelCompatibilityFormat(modelMetadata: CadModelMetadata): void;
43
43
  addModel(modelIdentifier: ModelIdentifier, geometryFilter?: GeometryFilter): Promise<CadNode>;
44
44
  removeModel(model: CadNode): void;
45
- getLoadingStateObserver(): Observable<LoadingState>;
45
+ on(event: 'loadingStateChanged', listener: (loadingState: LoadingState) => void): void;
46
+ off(event: 'loadingStateChanged', listener: (loadingState: LoadingState) => void): void;
46
47
  /**
47
48
  * Sets the Memory Cache size for all loaded models to the current budget
48
49
  * @param budget The budget to calculate cache size by
@@ -6,15 +6,16 @@ export interface BatchedDebounce<T, R> {
6
6
  (item: T): Promise<R>;
7
7
  cancel: () => void;
8
8
  }
9
+ type BatchCallback<T, R> = (items: T[]) => R extends void ? Promise<void> | void : Promise<R[]> | R[];
9
10
  /**
10
11
  * Creates a debounced function that batches multiple individual calls into a single batch operation.
11
12
  * Each call returns a promise that resolves with the corresponding result from the batch callback.
12
13
  *
13
14
  * @template T - The type of input items
14
- * @template R - The type of result items
15
+ * @template R - The type of result items (use void for callbacks that don't return results)
15
16
  *
16
- * @param callback - Function that processes a batch of items and returns results in the same order.
17
- * return an array with the same length as the input array.
17
+ * @param callback - Function that processes a batch of items. Should return an array with the same
18
+ * length as the input array, or void if no results are needed.
18
19
  * @param wait - The number of milliseconds to delay before processing the batch
19
20
  * @param options - Optional debounce options (leading, trailing, maxWait) passed to lodash debounce
20
21
  *
@@ -23,7 +24,8 @@ export interface BatchedDebounce<T, R> {
23
24
  *
24
25
  * @example
25
26
  * ```typescript
26
- * const batchedFetch = createBatchedDebounce(
27
+ * // With results
28
+ * const batchedFetch = batchedDebounce(
27
29
  * async (ids: number[]) => {
28
30
  * const response = await fetch('/api/items', {
29
31
  * method: 'POST',
@@ -37,7 +39,20 @@ export interface BatchedDebounce<T, R> {
37
39
  * const item1 = batchedFetch(1);
38
40
  * const item2 = batchedFetch(2);
39
41
  * const results = await Promise.all([item1, item2]);
40
- * // Both calls are batched into a single request
42
+ *
43
+ * // Without results (void)
44
+ * const batchedLog = batchedDebounce(
45
+ * async (ids: number[]) => {
46
+ * await fetch('/api/log', {
47
+ * method: 'POST',
48
+ * body: JSON.stringify({ ids })
49
+ * });
50
+ * },
51
+ * 100
52
+ * );
53
+ *
54
+ * await batchedLog(1);
41
55
  * ```
42
56
  */
43
- export declare function batchedDebounce<T, R>(callback: (items: T[]) => Promise<R[]> | R[], wait: number, options?: Parameters<typeof debounce>[2]): BatchedDebounce<T, R>;
57
+ export declare function batchedDebounce<T, R = void>(callback: BatchCallback<T, R>, wait: number, options?: Parameters<typeof debounce>[2]): BatchedDebounce<T, R>;
58
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognite/reveal",
3
- "version": "4.28.5-dev.20251203",
3
+ "version": "4.28.5-dev.20251204",
4
4
  "description": "WebGL based 3D viewer for CAD and point clouds processed in Cognite Data Fusion.",
5
5
  "homepage": "https://github.com/cognitedata/reveal/tree/master/viewer",
6
6
  "repository": {