Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

active-array

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

active-array

An array which fires a callback when either a count of items is reached, or an interval fires and a minimum count is present.

  • 0.0.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

ActiveArray

An array which fires a callback when either a count of items is reached, or an interval fires and a minimum count is present.

let x = new ActiveArray(callback, countThreshold, timeCountThreshold, intervalMilliseconds);

x.push(object);
console.log(x.length);

Example:

const ActiveArray = require('active-array');

let x = {};
let max = 5;
for (var i=0; i< max; i++) {
  let id = i;
  x[i] = new ActiveArray(function (list, why) { console.log(`fire ${why} ${id} ${list.length}`); }, 400, 100, 6000);
}
  
// periodically push messages into the buffers
setInterval(function () {
    let id = Math.floor(Math.random()*max);
    x[id].push("m"); // consume message from sqs and store here:
}, 1);

Keywords

FAQs

Package last updated on 14 Feb 2017

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