Expand all

ve.init.sa.SafeStorage

ve.init.sa.SafeStorage

Extends

Constructor

new ve.init.sa.SafeStorage(store) #

Implementation of ve.init.SafeStorage

Duplicate of mediawiki.storage.

Parameters:

Name Type Description
store Storage | undefined

The Storage instance to wrap around

Source:

Methods

clearExpired() → {jQuery.Promise}protected #

Clear any expired items from the store

Returns:

Resolves when items have been expired

Type
jQuery.Promise
Overrides:
Source:
Clear any expired items from the store

get(key) → {string|null|boolean} #

Retrieve value from device storage.

Parameters:

Name Type Description
key string

Key of item to retrieve

Returns:

String value, null if no value exists, or false if storage is not available.

Type
string | null | boolean
Overrides:
Source:
Retrieve value from device storage.

getExpiryKeys() → {jQuery.Promise}protected #

Get all keys with expiry values

Returns:

Promise resolving with all the keys which have expiry values (unprefixed), or as many could be retrieved in the allocated time.

Type
jQuery.Promise
Overrides:
Source:
Get all keys with expiry values

getObject(key) → {Object|null|boolean} #

Retrieve JSON object from device storage.

Parameters:

Name Type Description
key string

Key of item to retrieve

Returns:

Object, null if no value exists or value is not JSON-parseable, or false if storage is not available.

Type
Object | null | boolean
Overrides:
Source:
Retrieve JSON object from device storage.

isExpired(key) → {boolean}protected #

Check if a given key has expired

Parameters:

Name Type Description
key string

Key name

Returns:

Whether key is expired

Type
boolean
Overrides:
Source:
Check if a given key has expired

remove(key) → {boolean} #

Remove a value from device storage.

Parameters:

Name Type Description
key string

Key of item to remove

Returns:

Whether the save succeeded or not

Type
boolean
Overrides:
Source:
Remove a value from device storage.

set(key, value, [expiry]) → {boolean} #

Set a value in device storage.

Parameters:

Name Type Attributes Description
key string

Key name to store under

value string

Value to be stored

expiry number optional

Number of seconds after which this item can be deleted

Returns:

The value was set

Type
boolean
Overrides:
Source:
Set a value in device storage.

setExpires(key, [expiry]) #

Set the expiry time for an item in the store

Parameters:

Name Type Attributes Description
key string

Key name

expiry number optional

Number of seconds after which this item can be deleted, omit to clear the expiry (either making the item never expire, or to clean up when deleting a key).

Overrides:
Source:
Set the expiry time for an item in the store

setObject(key, value, [expiry]) → {boolean} #

Set an object value in device storage by JSON encoding

Parameters:

Name Type Attributes Description
key string

Key name to store under

value Object

Object value to be stored

expiry number optional

Number of seconds after which this item can be deleted

Returns:

The value was set

Type
boolean
Overrides:
Source:
Set an object value in device storage by JSON encoding