NativeStorage

v2.3.2

Contents

Installation

In order to use Ionic Enterprise Edition plugins you should make sure you're using the Ionic Enterprise Cordova CLI as the regular version can have issues with scoped plugins.

npm uninstall -g cordovanpm install -g @ionic-enterprise/cordova

Once you've installed the Ionic Enterprise Cordova CLI you can install the plugin.

ionic enterprise register --key=YOURPRODUCTKEYionic cordova plugin add @ionic-enterprise/nativestorage

Index

Classes


Classes

NativeStorage

NativeStorage:

name: Native Storage

description: Native storage of variables in Android and iOS

usage:

import { NativeStorage } from '@ionic-enterprise/nativestorage/ngx'; constructor(private nativeStorage: NativeStorage) { } ... this.nativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'}) .then( () => console.log('Stored item!'), error => console.error('Error storing item', error) ); this.nativeStorage.getItem('myitem') .then( data => console.log(data), error => console.error(error) );

clear

clear(): Promise<any>

Removes all stored values.

Returns: Promise<any>


getItem

getItem(reference: string): Promise<any>

Gets a stored item

Parameters:

Name Type Description
reference string -

Returns: Promise<any>


keys

keys(): Promise<any>

Retrieving all keys

Returns: Promise<any>


remove

remove(reference: string): Promise<any>

Removes a single stored item

Parameters:

Name Type Description
reference string -

Returns: Promise<any>


setItem

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

Stores a value

Parameters:

Name Type Description
reference string -
value any -

Returns: Promise<any>



Other Versions