Skip to content

Latest commit

 

History

History
66 lines (36 loc) · 1.83 KB

interaction-type.md

File metadata and controls

66 lines (36 loc) · 1.83 KB
layout tags
doc-api.html
internal, global-service

ally.observe.interactionType

Observes user interaction method to distinguish pointer and keyboard actions.

Description

Observes keyboard-, pointer-, mouse- and touch-events so that a query for the current interaction type can be made at any time. For pointer interaction this observer is limited to pointer button down/up - move is not observed!

Usage

var handle = ally.observe.interactionType();
// stop observing
handle.disengage();

// query current interaction type
var type = handle.get();

Arguments

Returns

A <global-service> interface, providing the handle.disengage() method to stop the service.

Throws

Service handle

The handle is returned when engaging the service. As the <global-service> interface describes, the handle.disengage() method is provided to stop the service. Additionally the following methods are made available:

handle.get()

The handle.get() method does not accept any arguments and returns an object with the following properties:

Name Type Description
key boolean true if any key is currently pressed.
pointer boolean true if any mouse button (or pointer, or touch) is currently pressed.

Examples

Notes

Related resources

Contributing