1.0.5 • Published 3 years ago

@varandas/capacitator-storage-wrapper v1.0.5

Weekly downloads
47
License
MIT
Repository
github
Last release
3 years ago

capacitator-storage-wrapper

A simple wrapper for ionic capacitator Storage plugin.

npm (scoped) npm

Build Status Codecov Coverage semantic-release Known Vulnerabilities GitHub license

Motivation

I needed an easier and faster way to use the capacitator storage plugin.

Usage

Install with your favourite package manager:

npm i @varandas/capacitator-storage-wrapper

OR

yarn add @varandas/capacitator-storage-wrapper

import Storage from '@varandas/capacitator-storage-wrapper'

// item we want to save:
const item = {
    foo: 'bar',
}

// the key we want to use
const key = 'item name'

// saving the item
await Storage.setItem(key, item)

// retrieving the item
try {
    const data = await Storage.getItem(key)
    // process data
} catch(error) {
    // Key was not found, handle exeption
}

// remove item
await Storage.removeItem(key)

// get all keys
const keys = await Storage.keys()

// clear all keys and values
await Storage.clear()

License - MIT André Varandas

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago