@types/d3-dispatch

  • Version 3.0.1
  • Published
  • 6.54 kB
  • No dependencies
  • MIT license

Install

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

Overview

TypeScript definitions for D3JS d3-dispatch module

Index

Functions

function dispatch

dispatch: <T extends object>(...types: string[]) => Dispatch<T>;
  • Creates a new dispatch for the specified event types. Each type is a string, such as "start" or "end".

    Parameter types

    The event types.

    Throws

    "illegal type" on empty string or duplicated event types.

Interfaces

interface Dispatch

interface Dispatch<T extends object> {}

    method apply

    apply: (type: string, that?: T, args?: any[]) => void;
    • Like function.apply, invokes each registered callback for the specified type, passing the callback the specified arguments, with that as the this context.

      Parameter type

      A specified event type.

      Parameter that

      The this context for the callback.

      Parameter args

      Additional arguments to be passed to the callback.

      Throws

      "unknown type" on unknown event type.

    method call

    call: (type: string, that?: T, ...args: any[]) => void;
    • Like function.call, invokes each registered callback for the specified type, passing the callback the specified arguments, with that as the this context. See dispatch.apply for more information.

      Parameter type

      A specified event type.

      Parameter that

      The this context for the callback.

      Parameter args

      Additional arguments to be passed to the callback.

      Throws

      "unknown type" on unknown event type.

    method copy

    copy: () => Dispatch<T>;
    • Returns a copy of this dispatch object. Changes to this dispatch do not affect the returned copy and vice versa.

    method on

    on: {
    (typenames: string): (this: T, ...args: any[]) => void;
    (typenames: string, callback: (this: T, ...args: any[]) => void): this;
    };
    • Returns the callback for the specified typenames, if any. If multiple typenames are specified, the first matching callback is returned.

    • Adds or removes the callback for the specified typenames. If a callback function is specified, it is registered for the specified (fully-qualified) typenames. If a callback was already registered for the given typenames, the existing callback is removed before the new callback is added. The specified typenames is a string, such as start or end.foo. The type may be optionally followed by a period (.) and a name; the optional name allows multiple callbacks to be registered to receive events of the same type, such as start.foo and start.bar. To specify multiple typenames, separate typenames with spaces, such as start end or start.foo start.bar. To remove all callbacks for a given name foo, say dispatch.on(".foo", null).

    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-dispatch.

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