Socket
Socket
Sign inDemoInstall

better-queue-persistent-store-layer

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    better-queue-persistent-store-layer

A pluggable persistent store layer for better-queue


Version published
Maintainers
1
Install size
33.4 kB
Created

Readme

Source

Better Queue - Persistent Store Layer

Example with localStorage

// create a storage layer with sync or async load and save methods with your preferred persistence method
const Store = ('better-queue-persistent-store-layer');
const Queue = ('better-queue');

class Storage {
    load(defaultValue = null) {
        const value = localStorage.getItem('queue');

        return (value && JSON.parse(value)) || defaultValue;
    }

    save(data) {
        localStorage.setItem('queue', JSON.stringify(data));
    }
};

const q = new Queue(fn, {
    store: new Store(new Storage())
});

Keywords

FAQs

Last updated on 09 Feb 2020

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc