Skip to content

Frontle-Foundation/cordova-keyvaluestorage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frontle Logo

The easiest multi-platform SPA framework.

NPM Version Package License NPM Downloads

Description

File-based key-value storage

Usage

import { CordovaKeyValueStorage } from "../../browser_modules/@frontle/cordova-keyvaluestorage/index.js";

// get instance
const cordovaKeyValueStorage = new CordovaKeyValueStorage();

// load storage
await cordovaKeyValueStorage.load();

// get storage directory entry
console.log(cordovaKeyValueStorage.getStorageDirEntry());

// save data
await cordovaKeyValueStorage.setItem('test', '123');

// get data
console.log(await cordovaKeyValueStorage.getItem('test')); // 123

Install

Frontle

$ frontle install @frontle/cordova-keyvaluestorage --noBuild

Download Vanilla JS Library

https://github.com/Frontle-Foundation/cordova-keyvaluestorage

API

new CordovaKeyValueStorage()

Creating a CordovaKeyValueStorage object. Single tone pattern used

const cordovaKeyValueStorage = new CordovaKeyValueStorage();

.load(storageFolderName = 'cordovaKeyValueStorage')

Load storage. You must run this function before you can use any of the other functions

await cordovaKeyValueStorage.load();

.getStorageDirEntry()

Get Storage directory entry

console.log(cordovaKeyValueStorage.getStorageDirEntry());

.setItem(key, value, fileName = key)

Save Value

await cordovaKeyValueStorage.setItem('test', '123');

.getItem(key, fileName = key)

Get Value

console.log(await cordovaKeyValueStorage.getItem('test')); // 123

People

The original author of @frontle/cordova-keyvaluestorage is MushStory

License

MIT