New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

buffered-kueue

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

buffered-kueue

Help you to buffer your tasks

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Buffered Kueue

Build Status codecov

Help you to buffer your tasks

Features

  • Having lifecycle hooks
  • Flushing specific amount of items when interval reached

Install

npm install --save buffered-kueue

yarn add buffered-kueue

Intro

Quick Start

Using class BufferedQueue.

const BufferedQueue = require('buffered-kueue')
let result = null
const queue = new BufferedQueue({onFlush: (items) => { result = items }, flushInterval: 1000, flushSize: 1})

queue.push(1) // after 1000ms result -> [1]
queue.push(2) // after 2000ms result -> [2]

API

class BufferedQueue

constructor(options) => bufferedQueue: BufferedQueue

The options beginning with the symbol * are required.

  • *options.maxSize: Max size of queue. Default: Infinity
    • number
  • *options.flushSize: Flush size of queue. Default: Infinity
    • number
  • *options.flushInterval: Flush interval(ms) of queue. Default: 1000
    • number
  • *options.onFlush: Flush handler. Default: noop
    • function: (flushItems, allItems) => any
  • options.willPush: Lifecycle events, called before pushing new item. Default: noop
    • function: (item, allItems) => any
  • options.didPush: Lifecycle events, called after pushing new item. Default: noop
    • function: (item, allItems) => any
  • options.willFlush: Lifecycle events, called before flushing. Default: noop
    • function: (flushItems, allItems) => any
  • options.didFlush: Lifecycle events, called after flushing. Default: noop
    • function: (flushItems, allItems) => any
  • options.willStart: Lifecycle events, called before start. Default: noop
    • function: () => any
  • options.didStart: Lifecycle events, called after start. Default: noop
    • function: () => any
  • options.willStop: Lifecycle events, called before stop. Default: noop
    • function: () => any
  • options.didStop: Lifecycle events, called after stop. Default: noop
    • function: () => any
  • options.autoStart: Should auto start when pushing item. You have to manage start manualy when setting this to false. Default: true
    • boolean
push(item)
  • item: Item which would be pushed into the queue.

Keywords

FAQs

Package last updated on 26 Feb 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc