Construct 3 icon

Construct 3

Documentation

Touch script interface

Ashley's avatar
Medal
Construct Team Founder
Published 14 Aug, 2019
127 words
<1 min

The ITouchObjectType interface derives from IObjectClass to add APIs specific to the Touch plugin.

Note this class derives from the object class interface, not the instance interface. Typically it is used through runtime.touch instead of the named object.

Touch APIs

async requestPermission(type)

Request permission to use device orientation or motion sensors. The "deviceorientation" and "devicemotion" events will not fire unless this method has been called and permission granted. type must be "orientation" or "motion". The user may be prompted to allow permission. Note some browsers merge both types in to one permission prompt in which case only one permission request is necessary to access both orientation and motion. Returns a promise that resolves with "granted" if permission was allowed, else "denied" if the user declined.