UNPKG

1.71 kBTypeScriptView Raw
1import Taro from '../../index'
2
3declare module '../../index' {
4 namespace vibrateShort {
5 interface Option {
6 /** 接口调用结束的回调函数(调用成功、失败都会执行) */
7 complete?: (res: TaroGeneral.CallbackResult) => void
8 /** 接口调用失败的回调函数 */
9 fail?: (res: TaroGeneral.CallbackResult) => void
10 /** 接口调用成功的回调函数 */
11 success?: (res: TaroGeneral.CallbackResult) => void
12 }
13 }
14
15 namespace vibrateLong {
16 interface Option {
17 /** 接口调用结束的回调函数(调用成功、失败都会执行) */
18 complete?: (res: TaroGeneral.CallbackResult) => void
19 /** 接口调用失败的回调函数 */
20 fail?: (res: TaroGeneral.CallbackResult) => void
21 /** 接口调用成功的回调函数 */
22 success?: (res: TaroGeneral.CallbackResult) => void
23 }
24 }
25
26 interface TaroStatic {
27 /** 使手机发生较短时间的振动(15 ms)。仅在 iPhone `7 / 7 Plus` 以上及 Android 机型生效
28 * @supported weapp, h5, rn
29 * @example
30 * ```tsx
31 * Taro.vibrateShort(params).then(...)
32 * ```
33 * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/vibrate/wx.vibrateShort.html
34 */
35 vibrateShort(option?: vibrateShort.Option): Promise<TaroGeneral.CallbackResult>
36
37 /** 使手机发生较长时间的振动(400ms)
38 * @supported weapp, h5, rn
39 * @example
40 * ```tsx
41 * Taro.vibrateLong(params).then(...)
42 * ```
43 * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/vibrate/wx.vibrateLong.html
44 */
45 vibrateLong(option?: vibrateLong.Option): Promise<TaroGeneral.CallbackResult>
46 }
47}