Socket
Socket
Sign inDemoInstall

@nextgis/queue

Package Overview
Dependencies
0
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @nextgis/queue

Manage concurrent asynchronous tasks with abort capabilities


Version published
Weekly downloads
105
increased by356.52%
Maintainers
3
Install size
67.0 kB
Created
Weekly downloads
 

Changelog

Source

2.3.0 (2024-06-07)

Bug Fixes

  • build-tools: fix rollup config to resolve node modules in browser (4f9c6b6)
  • cesium-map-adapter: put mouse click on terrain (fabb08a)

Features

  • cesium-map-adapter: implement geojson adapter removeLayer method (8151a19)
  • cesium-map-adapter: implement getZoom method (96ab1c7)
  • ngw-connector: implement clearCache method (17428b1)
  • ngw-map: add identify highlight possibility (40b3f90)
  • ngw-uploader: add useTus option (ef9e06f)

Readme

Source

Cache

size version

An advanced promise queue management library for JavaScript. This library is designed to handle the concurrency of any asynchronous tasks encapsulated in promises, providing optional debouncing to manage the flow of promise execution.

  • Limit the number of concurrent promises.
  • Optional debouncing to manage the timing of promise execution.
  • Ability to abort queued promises.
  • Efficient and orderly management of asynchronous operations.

Installation

In Browser

Include assets

Simply download and include with a script tag, Queue will be registered as a global variable.

<script src="../lib/queue.global.js"></script>

<script>
const queue = new Queue({ concurrency: 3, delay: 200 });

const asyncTask = function () {
  return new Promise((resolve) => setTimeout(() => resolve("Task Complete"), 1000));
};

queue.add(asyncTask);


const asyncWithAbort = () => {
  let timer;
  const promise = new Promise((resolve) => {
    timer = setTimeout(() => resolve("Another Task Complete"), 500);
  });
  const abortFunc = () => {
    clearTimeout(timer);
    console.log('Task was aborted');
  };
  return [promise, abortFunc]
}

queue.add(asyncWithAbort);
</script>
CDN

unpkg

<script src="https://unpkg.com/@nextgis/queue"></script>

jsdelivr

<script src="https://cdn.jsdelivr.net/npm/@nextgis/queue"></script>

We recommend linking to a specific version number /queue@[version]

In Node.js

npm install @nextgis/queue

Usage

import Queue from '@nextgis/queue';

const queue = new Queue({ concurrency: 2, delay: 100 });

const abortController = new AbortController();

queue.add(
  () =>
    fetch('https://api.example.com/data', {
      signal: abortController.signal,
    }),
  abortController.abort,
);

// Demonstrating the abort function
setTimeout(() => {
  queue.abort();
}, 100);

Check out the API Documentation

Commercial support

Need to fix a bug or add a feature to @nextgis/cache? We provide custom development and support for this software. Contact us to discuss options!

http://nextgis.com

Keywords

FAQs

Last updated on 07 Jun 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc