Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Database

Class used to enable access to IndexedDB

see

https://doc.babylonjs.com/how_to/caching_resources_in_indexeddb

Hierarchy

  • Database

Implements

Index

Constructors

constructor

  • new Database(urlToScene: string, callbackManifestChecked: (checked: boolean) => any, disableManifestCheck?: boolean): Database
  • Creates a new Database

    Parameters

    • urlToScene: string

      defines the url to load the scene

    • callbackManifestChecked: (checked: boolean) => any

      defines the callback to use when manifest is checked

        • (checked: boolean): any
        • Parameters

          • checked: boolean

          Returns any

    • Optional disableManifestCheck: boolean

      defines a boolean indicating that we want to skip the manifest validation (it will be considered validated and up to date)

    Returns Database

Properties

Static IDBStorageEnabledSearch playground for IDBStorageEnabled

IDBStorageEnabled: boolean

Gets a boolean indicating if Database storage is enabled (off by default)

Accessors

enableSceneOffline

  • get enableSceneOffline(): boolean
  • Gets a boolean indicating if scene must be saved in the database

    Returns boolean

enableTexturesOffline

  • get enableTexturesOffline(): boolean
  • Gets a boolean indicating if textures must be saved in the database

    Returns boolean

Methods

loadFileSearch playground for loadFile

  • loadFile(url: string, sceneLoaded: (data: any) => void, progressCallBack?: (data: any) => void, errorCallback?: () => void, useArrayBuffer?: boolean): void
  • Loads a file from database

    Parameters

    • url: string

      defines the URL to load from

    • sceneLoaded: (data: any) => void

      defines a callback to call on success

        • (data: any): void
        • Parameters

          • data: any

          Returns void

    • Optional progressCallBack: (data: any) => void

      defines a callback to call when progress changed

        • (data: any): void
        • Parameters

          • data: any

          Returns void

    • Optional errorCallback: () => void

      defines a callback to call on error

        • (): void
        • Returns void

    • Optional useArrayBuffer: boolean

      defines a boolean to use array buffer instead of text string

    Returns void

loadImageSearch playground for loadImage

  • loadImage(url: string, image: HTMLImageElement): void
  • Loads an image from the database

    Parameters

    • url: string

      defines the url to load from

    • image: HTMLImageElement

      defines the target DOM image

    Returns void

openSearch playground for open

  • open(successCallback: () => void, errorCallback: () => void): void
  • Open the database and make it available

    Parameters

    • successCallback: () => void

      defines the callback to call on success

        • (): void
        • Returns void

    • errorCallback: () => void

      defines the callback to call on error

        • (): void
        • Returns void

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method