Home Reference Source
public class | source

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
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 constructor(containers: HTMLElement[] | NodeList | HTMLElement, options: Object) source

Sensor constructor.

Params:

NameTypeAttributeDescription
containers HTMLElement[] | NodeList | HTMLElement

Containers

options Object

Options

Public Members

public containers: HTMLElement[] source

Current containers

Properties:

NameTypeAttributeDescription
containers *

public currentContainer: HTMLElement source

Current container

Properties:

NameTypeAttributeDescription
currentContainer *

public delay: Object source

The delay of each sensor

Properties:

NameTypeAttributeDescription
delay *

public dragging: Boolean source

Current drag state

Properties:

NameTypeAttributeDescription
dragging *

public lastEvent: * source

public options: Object source

Current options

Properties:

NameTypeAttributeDescription
options *

public startEvent: Event source

The event of the initial sensor down

Properties:

NameTypeAttributeDescription
startEvent *

Public Methods

public addContainer(containers: ...HTMLElement) source

Adds container to this sensor instance

Params:

NameTypeAttributeDescription
containers ...HTMLElement

Containers you want to add to this sensor

Example:

draggable.addContainer(document.body)

public attach(): Sensor source

Attaches sensors event listeners to the DOM

Return:

Sensor

public detach(): Sensor source

Detaches sensors event listeners to the DOM

Return:

Sensor

public removeContainer(containers: ...HTMLElement) source

Removes container from this sensor instance

Params:

NameTypeAttributeDescription
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:

NameTypeAttributeDescription
element HTMLElement

Element to trigger event on

sensorEvent SensorEvent

Sensor event to trigger

Return:

*