Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose data provider as a viewer property #502

Merged
merged 1 commit into from
Jan 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/viewer/Viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { CustomCameraControls } from "./CustomCameraControls";
import { ViewerLoadEvent } from "./events/ViewerLoadEvent";
import { cameraControlsToState } from "./Modes";
import { ViewerReferenceEvent } from "./events/ViewerReferenceEvent";
import { IDataProvider } from "../external/api";

/**
* @class Viewer
Expand Down Expand Up @@ -179,6 +180,20 @@ export class Viewer extends EventEmitter implements IViewer {
this._navigator);
}

/**
* Returns the data provider used by the viewer to fetch
* all contracts, ents, and buffers.
*
* @description The viewer's data provider can be set
* upon initialization through the {@link ViewerOptions.dataProvider}
* property.
*
* @returns {IDataProvider} The viewer's data provider.
*/
public get dataProvider(): IDataProvider {
return this._navigator.api.data;
}

/**
* Return a boolean indicating if the viewer is in a navigable state.
*
Expand Down