Files
DefinitelyTyped/d3-queue/index.d.ts
Tom Wanzek 61e748a7c0 Chores Fixes Enhancements Additions:
* d3-array: Changed name of import alias in test file for consistency with other test files. Deleted excess line at end of definition.
* d3-axis: Enhanced Axis.scale() getter to use generic for refined return type casting. Return type can now be more specific than AxisScale minimal interface compliance. Used `this` as return type for chainable setter methods on Axis.
* d3-brush: Use ValueFn type alias from d3-selection for harmonization of callbacks. Use `this` as return type of chainable setter methods. Fixed return type of BrushBehavior.move(...) to be void
* d3-chord: Use `this` as return type of chainable setter methods.
* d3-collection: Use `this` as return type of chainable setter methods.
* d3-color: Use `this` as return type of chainable setter methods. Added helper interface ColorCommonInstance as a fallback to allow extensibility of color spaces e.g. as through d3-hsv
* d3-dispatch: Use `this` as return type of chainable setter methods.
* d3-drag:  Use ValueFn type alias from d3-selection for harmonization of callbacks. Use `this` as return type of chainable setter methods.
* d3-ease: Removed excess space.
* d3-force: Use `this` as return type of chainable setter methods. Fixed return type of Simulation.tick() to be void. Fixed Force.initialize(...) to be optional when defining a custom force. Enhanced Simulation.force(...) getter to use generic to to cast return type to specific force type, when details are know. Updated related tests.
* d3-hsv: New definitions and tests added
* d3-interpolate: Use ColorCommonInstance to allow more general color spaces than the color space objects defined in d3-color, e.g. d3-hsv. Added related tests.
* d3-quadtree: Use `this` as return type of chainable setter methods.
* d3-scale: Fixed missing support of coercible numeric value as input to ScaleSequential. Use `this` as return type of chainable setter methods.
* d3-selection: Added type alias ValueFn which is used to harmonize callback functions. Use `this` as return type of chainable setter methods, where no new selection is returned. Removed outdated comments.
* d3-selection-multi: Added new definitions with tests.
* d3-shape: Use `this` as return type of chainable setter methods. Removed spurious `?` from callback signatures.
* d3-time: Use `this` as return type of chainable setter methods.
* d3-transition: Added type alias ValueFn which is used to harmonize callback functions. Use `this` as return type of chainable setter methods, where no new transition is returned.
* d3-voronoi: Use `this` as return type of chainable setter methods.
* d3-zoom:  Use `this` as return type of chainable setter methods. Note that ZoomTransform.scale(...) and ZoomTransform.translate(...) return new ZoomTranform objects. Use ValueFn to harmonize callbacks.

Updates the prime for the newly developed D3 version 4 definitions on a file-by-file basis.
2016-08-17 18:20:41 -04:00

56 lines
3.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Type definitions for D3JS d3-queue module 3.0.1
// Project: https://github.com/d3/d3-queue/
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* A d3-queue queue object as returned by queue(...)
*/
export interface Queue {
/**
* Adds the specified asynchronous task callback to the queue, with any optional arguments.
*
* @param 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.
* @param args Additional, optional arguments to be passed into deferred task on invocation
*/
defer(task: (...args: Array<any>) => void, ...args: any[]): this;
/**
* Aborts any active tasks, invoking each active tasks 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.
*/
abort(): this;
/**
* Sets the callback to be invoked when all deferred tasks have finished (individual result arguments).
*
* @param callback Callback function to be executed, when error occured 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.
*/
await(callback: (error: any | null, ...results: Array<any>) => void): this;
/**
* Sets the callback to be invoked when all deferred tasks have finished (results array).
*
* @param callback Callback function to be executed, when error occured 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.
*/
awaitAll(callback: (error: any | null, results?: Array<any>) => void): this;
}
/**
* 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.
*
* @param concurrency Maximum number of deferred tasks to execute concurrently.
*/
export function queue(concurrency?: number): Queue;