@novorender/web_app / OfflineViewState
Class: OfflineViewState
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
new OfflineViewState()
new OfflineViewState(storage, initialStorageEstimate): OfflineViewState
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
Defined in
@novorender/offline/state.ts:39
Methods
addScene()
addScene(id): Promise<undefined | OfflineScene>
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.
Defined in
@novorender/offline/state.ts:56
deleteAll()
deleteAll(): Promise<boolean>
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.
Defined in
@novorender/offline/state.ts:85
Properties
initialStorageEstimate
readonly 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.
Defined in
@novorender/offline/state.ts:43
logger
logger: undefined | Logger;
Logger for errors and status updates.
Defined in
@novorender/offline/state.ts:37
scenes
readonly scenes: Map<string, OfflineScene>;
Map of active offline scenes
Defined in
@novorender/offline/state.ts:34
storage
readonly storage: OfflineStorageOPFS;
The offline storage used.