1.0.1 • Published 3 years ago

chrome-storage-promises v1.0.1

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

chrome-storage-promises

This tiny module provides Promise based functions for extensions using chrome.storage

Installation

yarn add chrome-storage-promises

or

npm i chrome-storage-promises

You will also need the storage permission in your manifest file:

{
  "name": "My extension",
  ...
  "permissions": [
    "storage"
  ],
  ...
}

Usage

Before using this module, check out the official documentation of chrome.storage.

First import the desired storage method:

import { local } from "chrome-storage-promises";

Than, you can use it, like normal async/await promises:

await local.set({ test: "an-example-value" });

const testValue = await local.get("an-example-value");