Native Storage

The NativeStorage API provides a key-value store for simple data.

Note: this API is not meant for high-performance data storage applications. Take a look at using SQLite API or a separate data engine if your application will store a lot of items, have high read/write load, or require complex querying.

Classes


NativeStorage

set
set(reference: string, value: any): Promise <any>

PARAMETERS
reference: string
value: any

RETURN
returns: Promise <any>
clear
clear(): Promise <any>

Removes all stored values.


RETURN
returns: Promise <any>
keys
keys(): Promise <any>

Retrieving all keys.


RETURN
returns: Promise <any>
remove
remove(reference: string): Promise <any>

Removes a single stored item.


PARAMETERS
reference: string

RETURN
returns: Promise <any>
getBoolean
getBoolean(reference: string): Promise <any>

Gets a stored boolean.


PARAMETERS
reference: string

RETURN
returns: Promise <any>
putBoolean
putBoolean(reference: string, value: boolean): Promise <any>

Stores a boolean.


PARAMETERS
reference: string
value: boolean

RETURN
returns: Promise <any>
getInt
getInt(reference: string): Promise <any>

Gets a stored int.


PARAMETERS
reference: string

RETURN
returns: Promise <any>
putInt
putInt(reference: string, value: int): Promise <any>

Stores an int.


PARAMETERS
reference: string
value: int

RETURN
returns: Promise <any>
getDouble
getDouble(reference: string): Promise <any>

Gets a stored double.


PARAMETERS
reference: string

RETURN
returns: Promise <any>
putDouble
putDouble(reference: string, value: double): Promise <any>

Stores a double.


PARAMETERS
reference: string
value: double

RETURN
returns: Promise <any>
getString
getString(reference: string): Promise <any>

Gets a stored string.


PARAMETERS
reference: string

RETURN
returns: Promise <any>
putString
putString(reference: string, value: string): Promise <any>

Stores a string.


PARAMETERS
reference: string
value: string

RETURN
returns: Promise <any>
getObject
getObject(reference: string): Promise <any>

Gets a stored object.


PARAMETERS
reference: string

RETURN
returns: Promise <any>
putObject
putObject(reference: string, value: object): Promise <any>

Stores an object.


PARAMETERS
reference: string
value: object

RETURN
returns: Promise <any>
getItem
getItem(reference: string): Promise <any>

Gets a stored item.


PARAMETERS
reference: string

RETURN
returns: Promise <any>
setItem
setItem(reference: string, value: any): Promise <any>

Stores a value.


PARAMETERS
reference: string
value: any

RETURN
returns: Promise <any>

Interfaces Used

NativeStorageError

NativeStorageError {
    code: int; // One of NativeStorageErrorCode 
    source: string; //"Native"|"JS"  
    exception: string; // error description

}

Enumeration

NativeStorageErrorCode

enum NativeStorageErrorCode{
    NATIVE_WRITE_FAILED: 1,
    ITEM_NOT_FOUND: 2,
    NULL_REFERENCE: 3,
    UNDEFINED_TYPE: 4,
    JSON_ERROR: 5,
    WRONG_PARAMETER: 6
}