Class

StorageManager

StorageManager()

Constructor

# new StorageManager()

Storage Manager is responsible to initialise all storage implementation and return default or specified storage implementation when requested.

Methods

# addStorageDefinitions(config)

Add a list of storage configuration to StorageManager.

Parameters:
Name Type Description
config Array.<StorageConfig>

An array of StorageConfig that defines the storage implementations.

# deinit()

Call when destruct.

# async getStorage(typeopt) → {Promise.<Object>}

Get a specific type of Storage instance.

Parameters:
Name Type Attributes Default Description
type String <optional>
FIRST_CONFIG_ITEM

The type of storage to be retrieved. If the storage instance was not instantiated before, it will be instantiated. If the type is not defined, the default storage instance, which is

Native Promise, wrapping a Storage instance.

Promise.<Object>

# isStorageSupported() → {Boolean}

Check if the specified type of Storage is supported on this platform.

True when the specified type can be found in the internal storage registry, false otherwise.

Boolean

# removeStorage(type)

Remove a specific type of Storage from the manager.

Parameters:
Name Type Description
type String

The string that is used to identify the storage type to be removed from the manager.

# static singleton() → {StorageManager}

Get the StorageManager instance.

The StorageManager instance.

StorageManager()

Constructor

# new StorageManager()

This constructor should be not be called explicitly.

See:

Methods

# addStorageDefinitions(config)

Add a list of storage configuration to StorageManager.

Parameters:
Name Type Description
config Array.<StorageConfig>

An array of StorageConfig that defines the storage implementations.

# deinit()

Call when destruct.

# async getStorage(typeopt) → {Promise.<Object>}

Get a specific type of Storage instance.

Parameters:
Name Type Attributes Default Description
type String <optional>
FIRST_CONFIG_ITEM

The type of storage to be retrieved. If the storage instance was not instantiated before, it will be instantiated. If the type is not defined, the default storage instance, which is

Native Promise, wrapping a Storage instance.

Promise.<Object>

# isStorageSupported() → {Boolean}

Check if the specified type of Storage is supported on this platform.

True when the specified type can be found in the internal storage registry, false otherwise.

Boolean

# removeStorage(type)

Remove a specific type of Storage from the manager.

Parameters:
Name Type Description
type String

The string that is used to identify the storage type to be removed from the manager.

# static singleton() → {StorageManager}

Get the StorageManager instance.

The StorageManager instance.