Constructor
new DragDrop()
- See:
Example
const dragDrop = new DragDrop({
dragSelector: ".item",
dropSelector: ".items",
permissions: { dragstart: this._canDragStart.bind(this), drop: this._canDragDrop.bind(this) },
callbacks: { dragstart: this._onDragStart.bind(this), drop: this._onDragDrop.bind(this) }
});
dragDrop.bind(html);
Parameters:
Type | Description |
---|---|
DragDropConfiguration |
Members
callbacks :Object
A set of callback functions for each action of the Drag and Drop workflow
Type:
- Object
dragSelector :string
The HTML selector which identifies draggable elements
Type:
- string
dropSelector :string
The HTML selector which identifies drop targets
Type:
- string
permissions :Object
A set of permission checking functions for each action of the Drag and Drop workflow
Type:
- Object
Methods
bind(html)
Bind the DragDrop controller to an HTML application
Parameters:
Name | Type | Description |
---|---|---|
html |
HTMLElement | The HTML element to which the handler is bound |
callback(event, action)
Execute a callback function associated with a certain action in the workflow
Parameters:
Name | Type | Description |
---|---|---|
event |
DragEvent | The drag event being handled |
action |
string | The action being attempted |
can(action, selector) → {boolean}
Test whether the current user has permission to perform a step of the workflow
Parameters:
Name | Type | Description |
---|---|---|
action |
string | The action being attempted |
selector |
string | The selector being targeted |
Returns:
Can the action be performed?
- Type
- boolean