npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

event-queue-processor

v1.1.1

Published

Event queue processor for client-side JavaScript

Downloads

9

Readme

Event Queue Processor

npm version

Event Queue Processor is a JavaScript library for client-side event batching and processing.

Table of Contents

Installation

Install the library using npm:

npm install event-queue-processor

API Reference

You can configure the EventQueueProcessor by providing options during initialization. The available options include:

  • batchInterval (default: 5000): The time interval (in milliseconds) between batches.
  • maxRetries (default: 3): The maximum number of retry attempts for failed batches.
  • batchSize (default: 5): The maximum number of events to include in a batch.
  • serverRequest (default: _fakeServerRequest): The function responsible for sending events to the server.

addEventToQueue(event, priority)

The addEventToQueue method is used to add events to the event batch queue. You can call this method to enqueue events for later batch processing. The method takes two parameters:

  • event: The event object that you want to add to the batch. This can be any valid JavaScript object representing an event.
  • priority (optional): A boolean flag indicating whether the added event has priority. If set to true, the batch will be immediately sent to the server, bypassing the regular batch interval and size constraints.

Example

const EventQueueProcessor = require('event-queue-processor');

const options = {
    batchInterval: 3000,
    maxRetries: 5,
    batchSize: 10
};

// Create an instance of EventQueueProcessor
const eventQueueProcessor = new EventQueueProcessor(options);


// Add events to the batch
eventQueueProcessor.addEventToQueue({ type: 'click', target: 'button' }, true);
eventQueueProcessor.addEventToQueue({ type: 'hover', target: 'element' }, false);

// Simulate adding events during processing
setTimeout(() => {
    eventQueueProcessor.addEventToQueue({ type: 'scroll', target: 'window' });
    eventQueueProcessor.addEventToQueue({ type: 'keydown', target: 'input' });
}, 2000);

Contributor Guidelines

Branching Strategy

We use the GitHub flow for our branching model.

Setting Up the Development Environment

To set up your local development environment, follow these steps:

  1. Clone the repository.
  2. Install dependencies with npm install.

Bug Reports and Feature Requests

Please submit bug reports and feature requests through our issue tracker.

Pull Request Guidelines

  1. Fork the repository and create a new branch.

Contribution Recognition

Contributors will be acknowledged in the project documentation and release notes.

Thank you for contributing to our project!