You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
512 B
22 lines
512 B
import { IDevice } from "../T/IDevice";
|
|
|
|
/**
|
|
* 默认设备
|
|
*/
|
|
export default class DefaultDevice implements IDevice {
|
|
Vibrate(isLong: boolean) {
|
|
console.log("调用震动", isLong);
|
|
//判断平台是否支持
|
|
if (!navigator.vibrate) {
|
|
// 不支持
|
|
console.log("不支持设备震动!");
|
|
return;
|
|
}
|
|
//
|
|
if (isLong) {
|
|
navigator.vibrate(400);
|
|
} else {
|
|
navigator.vibrate(15);
|
|
}
|
|
}
|
|
}
|