Search docs/

NativeStorage

v2.3.2

Contents

インストール

最初に(一度限りの) セットアップ手順を実行したら, プラグインをインストールします。

Cordova:ionic cordova plugin add @ionic-enterprise/nativestorage Capacitor:npm install @ionic-enterprise/nativestorage npx cap sync

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