SessionStorageAPI¶
Interface SessionStorageAPI
changeSnapshot(
snapshotID: number,
properties: SnapshotProperties,
): SnapshotProperties;
changeSnapshot(
snapshotID: number,
name?: string,
screenshotURL?: string,
order?: number,
): SnapshotProperties;
createSnapshot(
name?: string,
options?: SnapshotCreationOptions,
): Promise<number>;
getSnapshotData(
snapshotID: number,
): { attachmentID: number; name: string; order: number };
getSnapshots(): number[];
importSession(data: any, format?: "xscn"): Promise<any>;
isOfflineStorageAvailable(): Promise<boolean>;
removeSnapshot(snapshotID: number): void;
requestSnapshotData(snapshotID: number): Promise<SnapshotProperties>;
restoreSession(handle: string): Promise<void>;
restoreSnapshot(
snapshotID: number,
options?: SnapshotRestoreOptions,
): Promise<void>;
storeSession(): Promise<string>;
transferSession(
progressCallback: StoreSessionProgressCallback,
): Promise<string>;
transferSession(): Promise<string>;
}
Hierarchy (View Summary)
- SessionStorageAPI
Methods
change Snapshot
- changeSnapshot(
snapshotID: number,
properties: SnapshotProperties,
): SnapshotProperties Changes one or more properties of a snapshot with the specified ID.
Triggers a SnapshotChangedEvent.
Parameters
- snapshotID: number
The ID of the snapshot to change.
- properties: SnapshotProperties
The properties of the snapshot to change.
Returns SnapshotProperties
An object with the changed properties.
- snapshotID: number
- changeSnapshot(
snapshotID: number,
name?: string,
screenshotURL?: string,
order?: number,
): SnapshotProperties Changes the textual description of the snapshot with the specified ID to the value of text.
Triggers a SnapshotChangedEvent.
Parameters
- snapshotID: number
The ID of the snapshot to change.
Optionalname: stringThe new name of the snapshot.
OptionalscreenshotURL: stringThe new screenshot URL of the snapshot.
Optionalorder: numberThe order inside the list of snapshots.
Returns SnapshotProperties
- snapshotID: number
create Snapshot
- createSnapshot(
name?: string,
options?: SnapshotCreationOptions,
): Promise<number> Creates a snapshot of the current session state.
Triggers a SnapshotCreationStartedEvent and, if successful, a SnapshotCreatedEvent.
Parameters
Optionalname: stringThe name of the snapshot.
Optionaloptions: SnapshotCreationOptionsOptions used for the snapshot creation.
Returns Promise<number>
The ID of the created snapshot.
get Snapshot Data
- getSnapshotData(
snapshotID: number,
): { attachmentID: number; name: string; order: number } Parameters
- snapshotID: number
The ID of the snapshot to request data for.
Returns { attachmentID: number; name: string; order: number }
The data of the specified snapshot.
Deprecated
getSnapshotData is deprecated. Please use requestSnapshotData instead.
- snapshotID: number
get Snapshots
import Session
- importSession(data: any, format?: "xscn"): Promise<any>
Imports a session from the given data string in the specified format.
Supported formats: xscn.
Parameters
- data: any
The content of the session file.
Optionalformat: "xscn"The format of the session file. Default: "xscn".
Returns Promise<any>
A Promise that resolves when the session is imported.
- data: any
is Offline Storage Available
remove Snapshot
- removeSnapshot(snapshotID: number): void
Deletes the snapshot for the given snapshot ID.
Triggers a SnapshotRemovedEvent.
Parameters
- snapshotID: number
The ID of the snapshot to delete.
Returns void
- snapshotID: number
request Snapshot Data
- requestSnapshotData(snapshotID: number): Promise<SnapshotProperties>
Requests the data of the specified snapshot.
Parameters
- snapshotID: number
The ID of the snapshot to request data for.
Returns Promise<SnapshotProperties>
The data of the specified snapshot.
- snapshotID: number
restore Session
restore Snapshot
- restoreSnapshot(
snapshotID: number,
options?: SnapshotRestoreOptions,
): Promise<void> Restores the snapshot for the given snapshot ID.
Triggers a SnapshotRestoreStartedEvent and, if successful, a SnapshotRestoredEvent.
Parameters
- snapshotID: number
The ID of the snapshot to restore.
Optionaloptions: SnapshotRestoreOptionsOptions to control the subset of snapshot data to restore.
Returns Promise<void>
A Promise that resolves when the snapshot is restored.
- snapshotID: number
store Session
- storeSession(): Promise<string>
Temporarily stores the session in the connected hub instance and returns an access handle.
This function does not transfer caches of referenced resources to the hub instance. For transferring caches, see transferSession.
Returns Promise<string>
The access handle of the stored session.
transfer Session
- transferSession(progressCallback: StoreSessionProgressCallback): Promise<string>
ExperimentalParameters
- progressCallback: StoreSessionProgressCallback
Can be used to track the progress of the transfer.
Returns Promise<string>
The access handle of the transferred session.
Deprecated
transferSession with progress callback is deprecated. Please use transferSession without parameters and utilize the returned promise instead!
Transfers the session to the connected hub instance and returns an access handle.
Transfers caches of referenced resources to the hub instance if they are not already present.
- progressCallback: StoreSessionProgressCallback
- transferSession(): Promise<string>
ExperimentalTransfers the session to the connected hub instance and returns an access handle.
Transfers caches of referenced resources to the hub instance if they are not already present.
Returns Promise<string>
The access handle of the transferred session.
Was this page helpful? Please leave a thumbs up or down.
SessionStorageAPI
Overview
The SessionStorageAPI provides tools to manage session storage and snapshots in webvis. A session represents the entire state of the 3D space, which can be shared, stored, and restored. Snapshots are subsets of a session that capture a momentary state, including elements like clip planes and measurements.
This API allows you to:
Quick Start
Example: Create a snapshot, modify its properties, and restore it.
Events
The following events are associated with the SessionStorageAPI: