vibrate.ts 468 字节
Newer Older
M
mehaotian 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
import {
  API_VIBRATE_SHORT,
  API_VIBRATE_LONG,
  defineAsyncApi,
  API_TYPE_VIBRATE_SHORT,
  API_TYPE_VIBRATE_LONG,
} from '@dcloudio/uni-api'

export const vibrateShort = defineAsyncApi<API_TYPE_VIBRATE_SHORT>(
  API_VIBRATE_SHORT,
  (_, { resolve }) => {
    plus.device.vibrate(15)
    resolve()
  }
)

export const vibrateLong = defineAsyncApi<API_TYPE_VIBRATE_LONG>(
  API_VIBRATE_LONG,
  (_, { resolve }) => {
    plus.device.vibrate(400)
    resolve()
  }
)