import Sensor from '@shopify/draggable/src/Draggable/Sensors/Sensor/Sensor.js'
Sensor
Base sensor class. Extend from this class to create a new or custom sensor
Constructor Summary
Public Constructor | ||
public |
constructor(containers: HTMLElement[] | NodeList | HTMLElement, options: Object) Sensor constructor. |
Member Summary
Public Members | ||
public |
containers: HTMLElement[] Current containers |
|
public |
currentContainer: HTMLElement Current container |
|
public |
The delay of each sensor |
|
public |
Current drag state |
|
public |
lastEvent: * |
|
public |
Current options |
|
public |
startEvent: Event The event of the initial sensor down |
Method Summary
Public Methods | ||
public |
addContainer(containers: ...HTMLElement) Adds container to this sensor instance |
|
public |
Attaches sensors event listeners to the DOM |
|
public |
Detaches sensors event listeners to the DOM |
|
public |
removeContainer(containers: ...HTMLElement) Removes container from this sensor instance |
|
public |
trigger(element: HTMLElement, sensorEvent: SensorEvent): * Triggers event on target element |
Public Constructors
Public Members
public containers: HTMLElement[] source
Current containers
Properties:
Name | Type | Attribute | Description |
containers | * |
public currentContainer: HTMLElement source
Current container
Properties:
Name | Type | Attribute | Description |
currentContainer | * |
public delay: Object source
The delay of each sensor
Properties:
Name | Type | Attribute | Description |
delay | * |
public dragging: Boolean source
Current drag state
Properties:
Name | Type | Attribute | Description |
dragging | * |
public lastEvent: * source
public startEvent: Event source
The event of the initial sensor down
Properties:
Name | Type | Attribute | Description |
startEvent | * |
Public Methods
public addContainer(containers: ...HTMLElement) source
Adds container to this sensor instance
Params:
Name | Type | Attribute | Description |
containers | ...HTMLElement | Containers you want to add to this sensor |
Example:
draggable.addContainer(document.body)
public removeContainer(containers: ...HTMLElement) source
Removes container from this sensor instance
Params:
Name | Type | Attribute | Description |
containers | ...HTMLElement | Containers you want to remove from this sensor |
Example:
draggable.removeContainer(document.body)
public trigger(element: HTMLElement, sensorEvent: SensorEvent): * source
Triggers event on target element
Params:
Name | Type | Attribute | Description |
element | HTMLElement | Element to trigger event on |
|
sensorEvent | SensorEvent | Sensor event to trigger |
Return:
* |