@varandas/capacitator-storage-wrapper
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

capacitator-storage-wrapper

A simple wrapper for ionic capacitator Storage plugin.

Capacitator storage Wrapper logo

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

Package Sidebar

Install

npm i @varandas/capacitator-storage-wrapper

Weekly Downloads

1

Version

1.0.5

License

MIT

Unpacked Size

12.6 kB

Total Files

6

Last publish

Collaborators

  • andrevarandas