@types/draggabilly
TypeScript icon, indicating that this package has built-in type declarations

2.1.6 • Public • Published

Installation

npm install --save @types/draggabilly

Summary

This package contains type definitions for draggabilly (https://draggabilly.desandro.com).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/draggabilly.

index.d.ts

export interface Position {
    x: number;
    y: number;
}

export interface DraggabillyOptions {
    axis?: "x" | "y" | undefined;
    containment?: Element | string | boolean | undefined;
    grid?: [number, number] | undefined;
    handle?: string | undefined;
}

export type DraggabillyClickEventName = "dragStart" | "dragEnd" | "pointerDown" | "pointerUp" | "staticClick";

export type DraggabillyMoveEventName = "dragMove" | "pointerMove";

export default class Draggabilly {
    position: Position;

    constructor(element: Element | string, options?: DraggabillyOptions);

    on(
        eventName: DraggabillyClickEventName,
        listener: (event: Event, pointer: MouseEvent | Touch) => void,
    ): Draggabilly;

    on(
        eventName: DraggabillyMoveEventName,
        listener: (event: Event, pointer: MouseEvent | Touch, moveVector: Position) => void,
    ): Draggabilly;

    off(
        eventName: DraggabillyClickEventName,
        listener: (event: Event, pointer: MouseEvent | Touch) => void,
    ): Draggabilly;

    off(
        eventName: DraggabillyMoveEventName,
        listener: (event: Event, pointer: MouseEvent | Touch, moveVector: Position) => void,
    ): Draggabilly;

    once(
        eventName: DraggabillyClickEventName,
        listener: (event: Event, pointer: MouseEvent | Touch) => void,
    ): Draggabilly;

    once(
        eventName: DraggabillyMoveEventName,
        listener: (event: Event, pointer: MouseEvent | Touch, moveVector: Position) => void,
    ): Draggabilly;

    enable(): void;

    disable(): void;

    destroy(): void;
}

Additional Details

  • Last updated: Mon, 06 Nov 2023 22:41:05 GMT
  • Dependencies: none

Credits

These definitions were written by Jason Wu.

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @types/draggabilly

      Weekly Downloads

      1,793

      Version

      2.1.6

      License

      MIT

      Unpacked Size

      5.72 kB

      Total Files

      5

      Last publish

      Collaborators

      • types