Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/martonlederer/chrome-storage-promises
Use chrome.storage with promises
https://github.com/martonlederer/chrome-storage-promises
Last synced: 3 days ago
JSON representation
Use chrome.storage with promises
- Host: GitHub
- URL: https://github.com/martonlederer/chrome-storage-promises
- Owner: martonlederer
- License: mit
- Created: 2021-02-11T19:01:01.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-02-12T10:55:49.000Z (almost 4 years ago)
- Last Synced: 2024-11-06T17:12:17.200Z (11 days ago)
- Language: TypeScript
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# chrome-storage-promises
This tiny module provides Promise based functions for extensions using chrome.storage
## Installation
```sh
yarn add chrome-storage-promises
```or
```sh
npm i chrome-storage-promises
```You will also need the `storage` permission in your manifest file:
```json
{
"name": "My extension",
...
"permissions": [
"storage"
],
...
}
```## Usage
Before using this module, check out the [official documentation](https://developer.chrome.com/docs/extensions/reference/storage) of `chrome.storage`.
First import the desired storage method:
```ts
import { local } from "chrome-storage-promises";
```Than, you can use it, like normal async/await promises:
```ts
await local.set({ test: "an-example-value" });const testValue = await local.get("an-example-value");
```