提交 e219b1e5 编写于 作者: DCloud-yyl's avatar DCloud-yyl

更新uni-getbatteryinfo插件版本为1.3.1

上级 e111c798
## 1.3.1(2023-09-15)
app端适配使用UniError
## 1.3.0(2023-05-30)
新增 同步获取电量api
## 1.2.0(2022-10-17) ## 1.2.0(2022-10-17)
实现百度小程序/支付宝小程序/QQ小程序获取电量 实现百度小程序/支付宝小程序/QQ小程序获取电量
## 1.1.0(2022-10-17) ## 1.1.0(2022-10-17)
实现ios平台获取电量 实现ios平台获取电量
......
{ {
"id": "uni-getbatteryinfo", "id": "uni-getbatteryinfo",
"displayName": "uni-getbatteryinfo", "displayName": "uni-getbatteryinfo",
"version": "1.3.0", "version": "1.3.1",
"description": "使用uts开发,实现在多个平台获取电池电量功能", "description": "使用uts开发,实现在多个平台获取电池电量功能",
"keywords": [ "keywords": [
"battery" "battery"
......
import Context from "android.content.Context"; import Context from "android.content.Context";
import BatteryManager from "android.os.BatteryManager"; import BatteryManager from "android.os.BatteryManager";
import { UTSAndroid } from "io.dcloud.uts";
import { GetBatteryInfo, GetBatteryInfoSuccess, GetBatteryInfoResult,GetBatteryInfoSync } from '../interface.uts' import { GetBatteryInfo, GetBatteryInfoOptions, GetBatteryInfoSuccess, GetBatteryInfoResult,GetBatteryInfoSync } from '../interface.uts'
/** /**
* 异步获取电量 * 异步获取电量
*/ */
......
declare namespace UniNamespace {
interface GetBatteryInfoSuccessCallbackResult {
/**
* 是否正在充电中
*/
isCharging: boolean;
/**
* 设备电量,范围 1 - 100
*/
level: number;
errMsg: string;
}
interface GetBatteryInfoOption {
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
*/
complete?: Function
/**
* 接口调用失败的回调函数
*/
fail?: Function
/**
* 接口调用成功的回调函数
*/
success?: (result: GetBatteryInfoSuccessCallbackResult) => void
}
}
declare interface Uni {
/**
* 获取设备电量
*
* 文档: [https://uniapp.dcloud.net.cn/api/system/batteryInfo.html](https://uniapp.dcloud.net.cn/api/system/batteryInfo.html)
*/
getBatteryInfo(option?: UniNamespace.GetBatteryInfoOption): void;
/**
* 同步获取电池电量信息
*/
GetBatteryInfoSync(): UniNamespace.GetBatteryInfoSuccessCallbackResult;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册