@novorender/api / OfflineViewState
Class: OfflineViewState
Defined in: @novorender/src/offline/state.ts:35
Viewstate for offline support UI.
Remarks
This view state serves as a base offline management UI. The purpose is to view and manage offline scenes, such as updating/synchronizing with newer versions online. A service worker will implement the actual offline support for the engine itself and will use the underlying storage objects for read access only. Error and status updates are reported to the logger property. By default it's undefined, so to display status, events and progress, you must assign your own object implementing the Logger interface.
Constructors
Constructor
new OfflineViewState(storage, initialStorageEstimate): OfflineViewState;
Defined in: @novorender/src/offline/state.ts:42
Parameters
Parameter | Type | Description |
---|---|---|
storage | OfflineStorageOPFS | The offline storage used. |
initialStorageEstimate | undefined | StorageEstimate | The initially estimated storage usage and quotas, if available. You may use navigator.estimate() to get the latest update, although this doesn't necessarily reflect recent changes, hence the term "estimate". See MDN for more details. |
Returns
OfflineViewState
Methods
addScene()
addScene(id): Promise<undefined | OfflineScene>;
Defined in: @novorender/src/offline/state.ts:58
Add a new scene to offline storage.
Parameters
Parameter | Type |
---|---|
id | string |
Returns
Promise
<undefined
| OfflineScene
>
The offline scene, or undefined if error.
Remarks
This function will merely mark the scene as an offline candidate. You need to call OfflineScene.sync for the scene to be downloaded and ready for offline use. Errors are logged in the logger.
deleteAll()
deleteAll(): Promise<boolean>;
Defined in: @novorender/src/offline/state.ts:87
Delete all offline data and remove every offline scene.
Returns
Promise
<boolean
>
True if success, False if an error occurred.
Remarks
Errors are logged in the logger.
Properties
initialStorageEstimate
readonly initialStorageEstimate: undefined | StorageEstimate;
Defined in: @novorender/src/offline/state.ts:46
The initially estimated storage usage and quotas, if available. You may use navigator.estimate()
to get the latest update, although this doesn't necessarily reflect recent changes, hence the term "estimate". See MDN for more details.
logger
logger: undefined | Logger;
Defined in: @novorender/src/offline/state.ts:40
Logger for errors and status updates.
scenes
readonly scenes: Map<string, OfflineScene>;
Defined in: @novorender/src/offline/state.ts:37
Map of active offline scenes
storage
readonly storage: OfflineStorageOPFS;
Defined in: @novorender/src/offline/state.ts:44
The offline storage used.