getDragAndDrop

API reference for the getDragAndDrop function.

Initializes the Drag and Drop capability.

Under the hood, this function:

  • Gets the dragAndDrop property from the window.canva object
  • Throws an error if the dragAndDrop property is not available
  • Provides type-safety when using TypeScript

Usage

import { getDragAndDrop } from "@canva/dnd";
const dragAndDrop = getDragAndDrop();
console.log(dragAndDrop); // => DragAndDrop

Returns

Returns an object that exposes the following methods: