Taro.startGyroscope(option)
Starts listening on gyroscope data.
Type
(option: Option) => Promise<CallbackResult>
Parameters
Option
Property | Type | Required | Description |
---|---|---|---|
interval | "game" | "ui" | "normal" | No | The execution interval of the callback function for gyroscope data listening. |
complete | (res: any) => void | No | The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail | (res: any) => void | No | The callback function for a failed API call |
success | (res: Result) => void | No | The callback function for a successful API call |
interval
Valid values of object.interval
Property | Description |
---|---|
game | The execution interval of the callback for game updates, which is about 20 ms. |
ui | The execution interval of the callback for UI updates, which is about 60 ms. |
normal | The normal callback interval, which is about 200 ms. |
API Support
API | WeChat Mini-Program | H5 | React Native |
---|---|---|---|
Taro.startGyroscope | ✔️ | ✔️ |