From 4e032867eca0d71943caf4fd7182319ade9ff03d Mon Sep 17 00:00:00 2001 From: yanyilin Date: Fri, 15 Sep 2023 17:50:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89index.d.ts=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dindex.uts=E4=B8=AD=E9=94=99=E8=AF=AF=E8=AF=AD=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uni_modules/uni-getbatteryinfo/index.d.ts | 37 ------------------- .../utssdk/app-android/index.uts | 3 +- 2 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 uni_modules/uni-getbatteryinfo/index.d.ts diff --git a/uni_modules/uni-getbatteryinfo/index.d.ts b/uni_modules/uni-getbatteryinfo/index.d.ts deleted file mode 100644 index 60b511f..0000000 --- a/uni_modules/uni-getbatteryinfo/index.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -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; -} diff --git a/uni_modules/uni-getbatteryinfo/utssdk/app-android/index.uts b/uni_modules/uni-getbatteryinfo/utssdk/app-android/index.uts index 6006789..776339c 100644 --- a/uni_modules/uni-getbatteryinfo/utssdk/app-android/index.uts +++ b/uni_modules/uni-getbatteryinfo/utssdk/app-android/index.uts @@ -5,9 +5,8 @@ import { UTSAndroid } from "io.dcloud.uts"; import { GetBatteryInfo, GetBatteryInfoSuccess, GetBatteryInfoResult,GetBatteryInfoSync } from '../interface.uts' /** * 异步获取电量 - * @param {Object} options */ -export const getBatteryInfo : GetBatteryInfo = function (options) { +export const getBatteryInfo : GetBatteryInfo = function (options : GetBatteryInfoOptions) { const context = UTSAndroid.getAppContext(); if (context != null) { const manager = context.getSystemService( -- GitLab