@types/d3-queue

  • Version 3.0.10
  • Published
  • 6.24 kB
  • No dependencies
  • MIT license

Install

npm i @types/d3-queue
yarn add @types/d3-queue
pnpm add @types/d3-queue

Overview

TypeScript definitions for d3-queue

Index

Functions

function queue

queue: (concurrency?: number) => Queue;
  • Construct a new queue with the specified concurrency. If concurrency is not specified, the queue has infinite concurrency. Otherwise, concurrency is a positive integer. For example, if concurrency is 1, then all tasks will be run in series. If concurrency is 3, then at most three tasks will be allowed to proceed concurrently; this is useful, for example, when loading resources in a web browser.

    Parameter concurrency

    Maximum number of deferred tasks to execute concurrently.

    Throws

    If concurrency is negative or zero, will throw an Error.

Interfaces

interface Queue

interface Queue {}
  • A d3-queue queue object as returned by queue(...)

method abort

abort: () => this;
  • Aborts any active tasks, invoking each active task’s task.abort function, if any. Also prevents any new tasks from starting, and immediately invokes the queue.await or queue.awaitAll callback with an error indicating that the queue was aborted.

method await

await: (callback: (error: any | null, ...results: any[]) => void) => this;
  • Sets the callback to be invoked when all deferred tasks have finished (individual result arguments).

    Parameter callback

    Callback function to be executed, when error occurred or all deferred tasks have completed. The first argument to the callback is the first error that occurred, or null if no error occurred. If an error occurred, there are no additional arguments to the callback. Otherwise, the callback is passed each result as an additional argument.

    Throws

    If called several times or after awaitAll, will throw an Error.

method awaitAll

awaitAll: (callback: (error: any | null, results?: any[]) => void) => this;
  • Sets the callback to be invoked when all deferred tasks have finished (results array).

    Parameter callback

    Callback function to be executed, when error occurred or all deferred tasks have completed. The first argument to the callback is the first error that occurred, or null if no error occurred. If an error occurred, there are no additional arguments to the callback. Otherwise, the callback is also passed an array of results as the second argument.

    Throws

    If called several times or after await, will throw an Error.

method defer

defer: (task: (...args: any[]) => void, ...args: any[]) => this;
  • Adds the specified asynchronous task callback to the queue, with any optional arguments.

    Parameter task

    Task to be executed.The task is a function that will be called when the task should start. It is passed the specified optional arguments and an additional callback as the last argument; the callback must be invoked by the task when it finishes. The task must invoke the callback with two arguments: the error, if any, and the result of the task. To return multiple results from a single callback, wrap the results in an object or array.

    Parameter args

    Additional, optional arguments to be passed into deferred task on invocation.

    Throws

    If called after an await, will throw an Error.

Package Files (1)

Dependencies (0)

No dependencies.

Dev Dependencies (0)

No dev dependencies.

Peer Dependencies (0)

No peer dependencies.

Badge

To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/d3-queue.

  • Markdown
    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/d3-queue)
  • HTML
    <a href="https://www.jsdocs.io/package/@types/d3-queue"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>