0.0.6 • Published 6 months ago

localforage-queue v0.0.6

Weekly downloads
-
License
-
Repository
-
Last release
6 months ago

localforage-queue

Based on localForage, some commonly used queue operations are implemented, which can be conveniently used in the browser.

Usage

BaseLocalForage

Add quota method, convenient for safer detection and practical use.

demoQueue.isQuotaExceededError(e) // Determine whether the error exception is over quota
await demoQueue.getRemaining() //  Get the remaining quota bits of the runtime environment (browser)

SlidingWindowQueue

Sliding window queue, used to maintain the length of the queue. When the length of the queue exceeds the set value, the data at the head or tail of the queue will be automatically deleted.

    const demoQueue = new SlidingWindowQueue(5, 'demo')
    const key = 'demo'
    await demoQueue.getItems(key) // Get queue information
    await demoQueue.pushHead(key, '1')  // Insert from the head, when it exceeds the set value, the data at the tail will be automatically deleted
    await demoQueue.enqueue(key, '1') // Insert from the tail, when it exceeds the set value, the data at the head will be automatically deleted
0.0.5

6 months ago

0.0.4

6 months ago

0.0.6

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago