import { IOfflineProvider } from "@babylonjs/core/Offline/IOfflineProvider"; import { ILoadFileProgressEvent } from "../../tools/request"; /** * Setups offline support for the scene loading using IndexedDB as offline storage. * This allows scenes and assets to be loaded from the local database when offline. * @param name defines the name of the database to setup */ export declare function setupOfflineProvider(name: string): void; /** * Creates a database for offline support and opens it. * If the database already exists in indexDB, it will be opened and returned. Otherwise, a new database will be created and opened. * @param name defines the name of the database to create (if doesn't exists) and open * @param urlToScene defines the Url of the scene to load. */ export declare function createAndOpenDatabase(name: string, urlToScene: string): Promise; export interface _IFilesObjectStore { url: string; data: string | ArrayBuffer | Blob; } export declare class Database implements IOfflineProvider { /** * Gets a boolean indicating if scene must be saved in the database */ enableSceneOffline: boolean; /** * Gets a boolean indicating if textures must be saved in the database */ enableTexturesOffline: boolean; /** * Defines the name of the database. */ readonly name: string; private _database; private _manifestVersion; private _loadFilePromises; constructor(name: string, urlToScene: string, callbackManifestChecked: (checked: boolean) => any, disableManifestCheck: boolean); private _checkManifest; /** * Open the offline support and make it available * @param successCallback defines the callback to call on success * @param errorCallback defines the callback to call on error */ open(successCallback?: () => void, errorCallback?: () => void): Promise; close(): void; /** * Loads an image from the offline support * @param url defines the url to load from * @param image defines the target DOM image */ loadImage(url: string, image: HTMLImageElement): Promise; saveImage(url: string): Promise; /** * Checks wehter or not the file located at the given URL is matching the current manifest version in the database. * @param url defines the URL to check the version for */ isFileMatchingVersion(url: string): Promise; /** * Loads a file from offline support * @param url defines the URL to load from * @param sceneLoaded defines a callback to call on success * @param progressCallBack defines a callback to call when progress changed * @param errorCallback defines a callback to call on error * @param useArrayBuffer defines a boolean to use array buffer instead of text string */ loadFile(url: string, sceneLoaded: (data: any) => void, progressCallBack?: (data: ILoadFileProgressEvent) => void, errorCallback?: () => void, useArrayBuffer?: boolean): Promise; saveFile(url: string, useArrayBuffer: boolean, progress?: (data: ILoadFileProgressEvent) => void): Promise; private _getFileVersionForUrl; }