Class: PersistenceManager

PersistenceManager

PersistenceManager used for offline support

Constructor

new PersistenceManager()

Source:

Methods

##browserFetch(request) → {Promise}

Call fetch without going through the persistence framework. This is the unproxied browser provided fetch API.
Parameters:
Name Type Description
request String | Request A USVString containing the direct URL of the resource you want to fetch or a Request object.
Source:
Returns:
Resolves to the Response when complete
Type
Promise

##forceOffline(offline)

Force the PersistenceManager offline.
Parameters:
Name Type Description
offline boolean If true, sets the PersistenceManager offline
Source:

##getCache() → {Promise}

Source:
Returns:
returns the cache store for the Persistence Framework. Implements the Cache API.
Type
Promise

##getRegistration(url) → {Promise}

Return the registration object for the URL
Parameters:
Name Type Description
url string Url
Source:
Returns:
Returns a Promise which resolves to the registration object for the URL or null.
Type
Promise

##getRegistrations() → {Promise}

Return an array of Registration objects
Source:
Returns:
Returns a Promise which resolves to an array of Registration objects.
Type
Promise

##getSyncManager() → {PersistenceSyncManager}

Return the Sync Manager
Source:
Returns:
Returns the Sync Manager
Type
PersistenceSyncManager

##init() → {Promise}

Source:
Returns:
returns a Promise when resolved that this PersistenceManager is fully initialized.
Type
Promise

##isOnline() → {boolean}

Checks if online. Returns true if the browser and PersistenceManager is online. Returns false if the browser or PersistenceManager is offline. Note: To determine if the browser is online, the function will use navigator.onLine whose behavior is browser specific. If being used in a hybrid mobile application, please install the Cordova plugin: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-network-information/ Installing the plugin will enable this function to return accurate browser online status.
Source:
Returns:
Returns true if online, false if not.
Type
boolean

##register(optionsopt) → {Promise}

Registers a URL for persistence
Parameters:
Name Type Attributes Description
options Object <optional>
Options to control registration
  • options.scope The URI which should be persisted.
Source:
Returns:
Returns a Promise which resolves to a PersistenceRegistration object for the specified options. If options is null, returns an array of all current PersistenceRegistration objects or null if there are none.
Type
Promise