JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q35274F
  • License Apache-2.0

A simple priority queue built on top of IndexedDB

Package Exports

  • idb-queue
  • idb-queue/dist/cjs
  • idb-queue/dist/cjs-compat
  • idb-queue/dist/esm
  • idb-queue/dist/esm-compat
  • idb-queue/package.json

Readme

idb-queue

npm version CI

Installation

npm install idb-queue

Usage

WIP

import {
  promisify,
  createStore,
  clear,
  push,
  peek,
  peekAll,
  peekBack,
  pop,
  shift,
  shiftAll,
} from 'idb-queue';

const retentionConfig = { maxNumber: 100, batchEvictionNumber: 10 };
const data = { key: Date.now(), value: {} };

await push(data, retentionConfig);
const shifted = await shift();

// Create your own store and key
const withStore = createStore('<dbName>', '<storeName>', '<key-can-be-sorted>');
const data = { '<key-can-be-sorted>': 1, value: {} };

await push(data, retentionConfig, withStore);
const shifted = await shift(1, withStore);
await clear(withStore);

Credit

Inspired by https://github.com/jakearchibald/idb-keyval