Socket
Book a DemoInstallSign in
Socket

@jacobmarshall/serviceworker-storage

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jacobmarshall/serviceworker-storage

localStorage like storage in ServiceWorker

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

serviceworker-storage

Storage that can be used like a localStorage easy-to-use on ServiceWorker.

install

npm install git://github.com/RyotaSugawara/serviceworker-storage.git

usage

new ServiceWorkerStorage(name, version)

create instance.

  • name: your storage name.
  • version: version number.
import ServiceWorkerStorage from 'serviceworker-storage';
const storage = new ServiceWorkerStoarge('MyStorage', 1);

getItem(key)

get item by key.

  • key: storage unique key.
storage.getItem('key').then(value => {
  console.log(value);
});

setItem(key, value)

set item to key.

  • key: storage unique key.
  • value: value you want to save.
storage.setItem(key, value);

removeItem(key)

remove item by key.

  • key: storage unique key.
storage.removeItem(key);

clear()

clear storage.

storage.clear();

FAQs

Package last updated on 17 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts