Skip to main content
Version: 3.x

Taro.startGyroscope(option)

Starts listening on gyroscope data.

Reference

Type

(option: Option) => Promise<CallbackResult>

Parameters

Option

PropertyTypeRequiredDescription
interval"game" | "ui" | "normal"NoThe execution interval of the callback function for gyroscope data listening.
complete(res: any) => voidNoThe callback function used when the API call completed (always executed whether the call succeeds or fails)
fail(res: any) => voidNoThe callback function for a failed API call
success(res: Result) => voidNoThe callback function for a successful API call

interval

Valid values of object.interval

PropertyDescription
gameThe execution interval of the callback for game updates, which is about 20 ms.
uiThe execution interval of the callback for UI updates, which is about 60 ms.
normalThe normal callback interval, which is about 200 ms.

API Support

APIWeChat Mini-ProgramH5React Native
Taro.startGyroscope✔️✔️