chrome-storage

1.0.3 • Public • Published

Description

Helper class for the Chrome Storage API.

Installation

This package is publicly available through npm (chrome-storage). Navigate to the root of your project directory and run:

npm install chrome-storage

Usage

var Storage = require("./index.js");
 
// optionally set storage configuration
Storage.configure({
    scope: "sync", // or "local"
});
 
// load the existing storage into memory
Storage.load(function() {
    // set a storage key
    Storage.set("installtime", Date.now());
    // set storage keys
    Storage.set({
        installtime: Date.now(),
        type: "referral",
    });
    // get a storage key
    Storage.get("installtime", 0); // outputs key's value or 0 if undefined
    // get storage keys
    Storage.get(["installtime", "type"]); // outputs an object of key/values
    // clear some keys from storage
    Storage.remove(["installtime", "otherkey"]);
    // clear all storage
    Storage.clear();
});

Package Sidebar

Install

npm i chrome-storage

Weekly Downloads

0

Version

1.0.3

License

ISC

Last publish

Collaborators

  • stevebinder