dlt.vibrate
Introduction
Triggers vibration on the phone.
Usage Limitations
Supported by basic library version 4.0.0 or higher.
Parameters
Object object
Attribute | Type | Default Value | Required | Description |
---|---|---|---|---|
milliseconds | number | Yes | Duration of vibration (0-1000ms) | |
success | function | No | Callback function for a successful API call | |
fail | function | No | Callback function for a failed API call | |
complete | function | No | Callback function for the end of an API call (executed for both successful and failed calls) |
Sample Code
// pages/index/index.js
Page({
vibrate() {
dlt.vibrate({
milliseconds: 500,
success: function (res) {},
fail: function (res) {},
complete: function (res) {},
});
},
});