Class: PersistenceStoreManager

QuickNav

PersistenceStoreManager

PersistenceStoreManager used for offline support

Constructor

new PersistenceStoreManager()

Methods

deleteStore(name, options) → {Promise.<Boolean>}

Delete the specific store, including all the content stored in the store.
Parameters:
Name Type Description
name string The name of the store to delete
options {version: string} | null Optional options when perform the delete.
  • options.version The version of this store to delete. If not specified, all versions of the store will be deleted.
Returns:
Returns a Promise which resolves to true if the store is actually deleted, and false otherwise.
Type
Promise.<Boolean>

getStoresMetadata() → {Promise.<Map.<String, PersistenceStoreMetadata>>}

Returns a promise that resolves to a Map of store name and store metadata.
Returns:
Returns a Map of store name and store metadata.
Type
Promise.<Map.<String, PersistenceStoreMetadata>>

hasStore(name, options) → {boolean}

Check whether a specific version of a specific store exists or not.
Parameters:
Name Type Description
name string The name of the store to check for existence
options {version: string} | null Optional options when perform the check.
  • options.version The version of this store to check. If not specified, any version of the store counts.
Returns:
Returns true if the store with the name exists of the specific version, false otherwise.
Type
boolean

openStore(name, options) → {Promise.<PersistenceStore>}

Get hold of a store for a collection of records of the same type. Returns a promise that resolves to an instance of PersistenceStore that's ready to be used.
Parameters:
Name Type Description
name string Name of the store.
options {index: Array, version: string} | null Optional options to tune the store
  • options.index array of fields to create index for
  • options.version The version of this store to open, default to be '0'.
Returns:
Returns an instance of a PersistenceStore.
Type
Promise.<PersistenceStore>

registerDefaultStoreFactory(factory)

Register the default PersistenceStoreFactory to create PersistenceStore for stores that don't have any factory registered under.
Parameters:
Name Type Description
factory Object The factory instance used to create PersistenceStore