提交 7a59aa64 编写于 作者: Anne_LXM's avatar Anne_LXM

更新on、off之类api

上级 fe30ac8a
......@@ -21,7 +21,15 @@
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|HBuilderX 2.2.3+|x|基础库2.7+|x|x|x|√|√|√|
**CALLBACK 返回参数**
**参数**
function listener
键盘高度变化事件的监听函数
**参数**
Object res
|参数|类型|说明|
|:-|:-|:-|
......@@ -45,10 +53,20 @@ uni.onKeyboardHeightChange(res => {
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|HBuilderX 3.1.0+|x|基础库2.9.2+|x|x|x|x|x|√|
**参数**
function listener
onKeyboardHeightChange 传入的监听函数。不传此参数则移除所有监听函数。
**示例代码**
```js
uni.offKeyboardHeightChange(callback)
const listener = function (res) { console.log(res) }
uni.onKeyboardHeightChange(listener)
uni.offKeyboardHeightChange(listener) // 需传入与监听时同一个的函数对象
```
### uni.getSelectedTextRange(OBJECT) @getselectedtextrange
......
### uni.onAccelerometerChange(CALLBACK)
监听加速度数据,频率:5次/秒,接口调用后会自动开始监听,可使用 ``uni.offAccelerometer`` 取消监听。
**CALLBACK 返回参数**
**参数**
function listener
加速度数据事件的监听函数
**参数**
Object res
|参数|类型|说明|
|:-|:-|:-|
......@@ -32,6 +40,22 @@ uni.onAccelerometerChange(function (res) {
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|HBuilderX 2.9.6+|HBuilderX 2.9.6+|基础库 2.9.3+|x|x|x|x|√|√|
**参数**
function listener
onAccelerometerChange 传入的监听函数。不传此参数则移除所有监听函数。
**示例**
```javascript
const listener = function (res) { console.log(res) }
uni.onAccelerometerChange(listener)
uni.offAccelerometerChange(listener) // 需传入与监听时同一个的函数对象
```
### uni.startAccelerometer(OBJECT)
开始监听加速度数据。
......
......@@ -27,9 +27,10 @@
**代码示例**
```javascript
uni.onMemoryWarning(function () {
console.log('onMemoryWarningReceive')
})
const callback = function (res) {
console.log(res,'onMemoryWarningReceive');
}
uni.onMemoryWarning(callback);
```
### uni.offMemoryWarning(CALLBACK)
......@@ -44,10 +45,20 @@ uni.onMemoryWarning(function () {
|x|x|√|√|√|x|x|√|√|
**参数**
|属性 | 类型|说明|
|-- |-- |-- |
| 回调函数| Function|内存不足告警事件的回调函数|
**代码示例**
```javascript
const callback = function (res) {
console.log(res);
}
uni.onMemoryWarning(callback);
// 和 onMemoryWarning 传入同一个函数即可
uni.offMemoryWarning(callback);
```
**Tips**
- `CALLBACK`为调用`uni.onMemoryWarning`时传入的`CALLBACK`
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册