Region
Allows the user to specify a region to capture all events to feed ZingTouch into. This can be as narrow as the element itself, or as big as the document itself. The more specific an area, the better performant the overall application will perform. Contains API methods to bind/unbind specific elements to corresponding gestures. Also contains the ability to register/unregister new gestures.
Test:
Constructor Summary
Public Constructor | ||
public |
constructor(element: Element, capture: boolean, preventDefault: boolean, id: Number) Constructor function for the Region class. |
Member Summary
Public Members | ||
public |
Whether the region listens for captures or bubbles. |
|
public |
The element being bound to. |
|
public |
The identifier for the Region. |
|
public |
Boolean to disable browser functionality such as scrolling and zooming over the region |
|
public |
The internal state object for a Region. |
Method Summary
Public Methods | ||
public |
bind(element: Element, gesture: String | Object, handler: Function, capture: Boolean, bindOnce: Boolean): Object Bind an element to a registered/unregistered gesture with multiple function signatures. |
|
public |
Bind an element and sets up actions to remove the binding once it has been emitted for the first time. |
|
public |
Registers a new gesture with an assigned key |
|
public |
Unbinds an element from either the specified gesture or all if no element is specified. |
|
public |
unregister(key: String | Object): Object Un-registers a gesture from the Region's state such that it is no longer emittable. Unbinds all events that were registered with the type. |
Public Constructors
public constructor(element: Element, capture: boolean, preventDefault: boolean, id: Number) source
Constructor function for the Region class.
Params:
Name | Type | Attribute | Description |
element | Element | The element to capture all window events in that region to feed into ZingTouch. |
|
capture | boolean |
|
Whether the region listens for captures or bubbles. |
preventDefault | boolean |
|
Whether the default browser functionality should be disabled; |
id | Number | The id of the region, assigned by the ZingTouch object. |
Public Members
public id: Number source
The identifier for the Region. This is assigned by the ZingTouch object and is used to hash gesture ids for uniqueness.
Public Methods
public bind(element: Element, gesture: String | Object, handler: Function, capture: Boolean, bindOnce: Boolean): Object source
Bind an element to a registered/unregistered gesture with multiple function signatures.
Params:
Name | Type | Attribute | Description |
element | Element | The element object. |
|
gesture | String | Object |
|
Gesture key, or a Gesture object. |
handler | Function |
|
The function to execute when an event is emitted. |
capture | Boolean |
|
capture/bubble |
bindOnce | Boolean |
|
= false] - Option to bind once and only emit the event once. |
Example:
bind(element) - chainable
bind(element, gesture, handler, [capture])
Test:
public bindOnce(element: Element, gesture: String | Object, handler: Function, capture: Boolean): Object source
Bind an element and sets up actions to remove the binding once it has been emitted for the first time.
- bind(element) - chainable
- bind(element, gesture, handler, [capture])
public unbind(element: Element, gesture: String | Object): Array source
Unbinds an element from either the specified gesture or all if no element is specified.
Params:
Name | Type | Attribute | Description |
element | Element | The element to remove. |
|
gesture | String | Object |
|
A String representing the gesture, or the actual object being used. |