From f05af856560a19d622a19732fa16f5baa2d68d94 Mon Sep 17 00:00:00 2001 From: SgLy <775150558@qq.com> Date: Wed, 8 Jan 2020 21:51:25 +0800 Subject: [PATCH 001/205] fix(api): fix some api type mistake close #95 --- CHANGELOG.md | 3 +++ VERSIONS.md | 2 +- package-lock.json | 2 +- package.json | 2 +- test/issue.test.ts | 41 ++++++++++++++++++++++++++++++++++++++++ types/wx/lib.wx.api.d.ts | 17 +++++++++++++---- 6 files changed, 60 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 341c41a..57607e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2020-01-07 v2.10.0-1 +- 修复接口错误(#95) + ## 2020-01-07 v2.10.0 - 同步 API 定义到基础库 2.10.0 diff --git a/VERSIONS.md b/VERSIONS.md index f40a8fc..c1b4815 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -2,7 +2,7 @@ 基础库版本|npm 版本|命令 -|-|- -[v2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-0-2019-12-24) | [2.10.0](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.0) | `npm install miniprogram-api-typings@2.10.0` +[v2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-0-2019-12-24) | [2.10.0-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.0-1) | `npm install miniprogram-api-typings@2.10.0-1` [v2.9.4](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-9-4-2019-11-28) | [2.9.4](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.4) | `npm install miniprogram-api-typings@2.9.4` [v2.9.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/) | [2.9.3](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.3) | `npm install miniprogram-api-typings@2.9.3` [v2.9.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-9-2-2019-11-04) | [2.9.2](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.2) | `npm install miniprogram-api-typings@2.9.2` diff --git a/package-lock.json b/package-lock.json index 8f558f3..c882c2a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.10.0", + "version": "2.10.0-1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index fab53c4..6cd3ae4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.10.0", + "version": "2.10.0-1", "description": "Type definitions for APIs of Wechat Mini Program in TypeScript", "main": "./index.d.ts", "types": "./index.d.ts", diff --git a/test/issue.test.ts b/test/issue.test.ts index c79d636..4afcb32 100644 --- a/test/issue.test.ts +++ b/test/issue.test.ts @@ -227,3 +227,44 @@ import WX = WechatMiniprogram }, }) } + +// https://github.com/wechat-miniprogram/api-typings/issues/95 +{ + Page({ + ctx: {} as WechatMiniprogram.CameraContext, + onLoad() { + this.ctx = wx.createCameraContext() + }, + takePhoto() { + this.ctx.takePhoto({ + quality: 'high', + success: (res) => { + expectType(res.tempImagePath) + this.setData({ + src: res.tempImagePath, + }) + }, + }) + }, + startRecord() { + this.ctx.startRecord({ + success: (res) => { + expectType(res.errMsg) + console.log('startRecord') + }, + }) + }, + stopRecord() { + this.ctx.stopRecord({ + success: (res) => { + expectType(res.tempThumbPath) + expectType(res.tempVideoPath) + this.setData({ + src: res.tempThumbPath, + videoSrc: res.tempVideoPath, + }) + }, + }) + }, + }) +} diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index 07d0ac4..e1bf839 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -1981,7 +1981,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb * * 用户授权结果 */ authSetting: AuthSetting - /** 用户订阅消息(包括一次性订阅消息和永久订阅消息)的订阅状态,需要接口参数withSubscriptions值为true时才会返回。subscriptionsSetting对象的键为**一次性订阅消息的模板id**或**永久订阅消息的类型**,值为'accept'、'reject'、'ban'中的其中一种,'accept'表示用户同意订阅该条订阅消息,'reject'表示用户拒绝订阅该订阅消息,'ban'表示已被后台封禁。一次性订阅消息使用方法详见 [wx.requestSubscribeMessage](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html),永久订阅消息(仅小游戏可用)使用方法详见[wx.requestSubscribeSystemMessage](#) + /** 用户订阅消息(包括一次性订阅消息和系统订阅消息)的订阅状态,需要接口参数withSubscriptions值为true时才会返回。subscriptionsSetting对象的键为**一次性订阅消息的模板id**或**系统订阅消息的类型**,值为'accept'、'reject'、'ban'中的其中一种,'accept'表示用户同意订阅该条订阅消息,'reject'表示用户拒绝订阅该订阅消息,'ban'表示已被后台封禁。一次性订阅消息使用方法详见 [wx.requestSubscribeMessage](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html),系统订阅消息(仅小游戏可用)使用方法详见[wx.requestSubscribeSystemMessage](#) * * 最低基础库: `2.10.0` */ subscriptionsSetting: IAnyObject @@ -4338,6 +4338,11 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: SetZoomSuccessCallback } + interface SetZoomSuccessCallbackResult { + /** 实际设置的缩放级别。由于系统限制,某些机型可能无法设置成指定值,会改用最接近的可设值。 */ + zoom: number + errMsg: string + } interface ShowActionSheetOption { /** 按钮的文字数组,数组长度最大为 6 */ itemList: string[] @@ -4933,8 +4938,8 @@ innerAudioContext.onError((res) => { success?: TakePhotoSuccessCallback } interface TakePhotoSuccessCallbackResult { - /** 实际设置的缩放级别。由于系统限制,某些机型可能无法设置成指定值,会改用最接近的可设值。 */ - zoom: number + /** 照片文件的临时路径 (本地路径),安卓是jpg图片格式,ios是png */ + tempImagePath: string errMsg: string } interface TextMetrics { @@ -12610,6 +12615,10 @@ wx.requestPayment({ requestPayment(option: RequestPaymentOption): void /** [wx.requestSubscribeMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html) * +* 调起客户端小程序订阅消息界面,返回用户订阅消息的操作结果。 +* +* 注意:[2.8.2](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为或者发起支付回调后,才可以调起订阅消息界面。 +* * 当用户勾选了订阅面板中的“总是保持以上选择,不再询问”时,模板消息会被添加到用户的小程序设置页,通过 [wx.getSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.getSetting.html) 接口可获取用户对相关模板消息的订阅状态。 * * **示例代码** @@ -15451,7 +15460,7 @@ wx.writeBLECharacteristicValue({ /** 接口调用失败的回调函数 */ type SetZoomFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ - type SetZoomSuccessCallback = (res: GeneralCallbackResult) => void + type SetZoomSuccessCallback = (result: SetZoomSuccessCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ShowActionSheetCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ From 61134744e37ecbce661fd2ad1017b95083bd8705 Mon Sep 17 00:00:00 2001 From: SgLy <775150558@qq.com> Date: Sun, 19 Jan 2020 20:47:03 +0800 Subject: [PATCH 002/205] feat(baselib): definition for 2.10.1 and bug fix closes #96 closes #99 --- CHANGELOG.md | 5 + VERSIONS.md | 1 + package-lock.json | 2 +- package.json | 2 +- test/api_doc.test.ts | 32 ++- test/app.test.ts | 4 + test/component.test.ts | 98 +++++++++ test/issue.test.ts | 6 +- types/wx/lib.wx.api.d.ts | 353 +++++++-------------------------- types/wx/lib.wx.app.d.ts | 5 + types/wx/lib.wx.component.d.ts | 230 +++++++++++++++++++-- 11 files changed, 432 insertions(+), 306 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57607e1..e60b759 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2020-01-19 v2.10.1 +- 同步 API 定义到基础库 2.10.1 +- 补齐 `Component` `selectOwnerComponent`, `animate`, `clearAnimation`(#96) +- 补齐 `App` `onUnhandledRejection`(#99) + ## 2020-01-07 v2.10.0-1 - 修复接口错误(#95) diff --git a/VERSIONS.md b/VERSIONS.md index c1b4815..93118f2 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -2,6 +2,7 @@ 基础库版本|npm 版本|命令 -|-|- +[v2.10.1](https://developers.weixin.qq.com/miniprogram/dev/framework/release/) | [2.10.1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.1) | `npm install miniprogram-api-typings@2.10.1` [v2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-0-2019-12-24) | [2.10.0-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.0-1) | `npm install miniprogram-api-typings@2.10.0-1` [v2.9.4](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-9-4-2019-11-28) | [2.9.4](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.4) | `npm install miniprogram-api-typings@2.9.4` [v2.9.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/) | [2.9.3](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.3) | `npm install miniprogram-api-typings@2.9.3` diff --git a/package-lock.json b/package-lock.json index c882c2a..9c95d8e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.10.0-1", + "version": "2.10.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 6cd3ae4..eebd906 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.10.0-1", + "version": "2.10.1", "description": "Type definitions for APIs of Wechat Mini Program in TypeScript", "main": "./index.d.ts", "types": "./index.d.ts", diff --git a/test/api_doc.test.ts b/test/api_doc.test.ts index 604313b..ea98d52 100644 --- a/test/api_doc.test.ts +++ b/test/api_doc.test.ts @@ -933,10 +933,9 @@ import { expectType } from 'tsd' { wx.getSetting({ success(res) { - res.authSetting = { - 'scope.userInfo': true, - 'scope.userLocation': true, - } + expectType(res.authSetting['scope.address']) + expectType(res.subscriptionsSetting.mainSwitch) + expectType>(res.subscriptionsSetting.itemSettings) }, }) } @@ -3042,15 +3041,26 @@ import { expectType } from 'tsd' }) } -// Test case from `wx.getSetting` +// Test case from `wx.chooseMedia` { - wx.getSetting({ - withSubscriptions: true, + wx.chooseMedia({ + count: 9, + mediaType: ['image', 'video'], + sourceType: ['album', 'camera'], + maxDuration: 30, + camera: 'back', success(res) { - expectType(res.authSetting) - expectType(res.authSetting['scope.userInfo']) - expectType(res.authSetting['scope.subscribeMessage']) - expectType>(res.subscriptionsSetting) + expectType(res.tempFiles[0].tempFilePath) + expectType(res.tempFiles[0].thumbTempFilePath) + expectType(res.tempFiles[0].width) + expectType(res.tempFiles[0].height) + expectType(res.tempFiles[0].size) + expectType(res.tempFiles[0].duration) }, }) } + +// Test case from `wx.reportPerformance` +{ + wx.reportPerformance(1101, 680) +} diff --git a/test/app.test.ts b/test/app.test.ts index e450cd9..5fb9298 100644 --- a/test/app.test.ts +++ b/test/app.test.ts @@ -39,6 +39,10 @@ App({ onPageNotFound(e) { expectType(e.isEntryPage) }, + onUnhandledRejection({ reason, promise }) { + expectType(reason) + expectType>(promise) + }, }) expectType>>(getApp()) diff --git a/test/component.test.ts b/test/component.test.ts index c47f772..d8d70ed 100644 --- a/test/component.test.ts +++ b/test/component.test.ts @@ -288,3 +288,101 @@ Component({ onAChange() {}, }, }) + +Component({ + methods: { + animate() { + this.animate( + '#container', + [ + { opacity: 1.0, rotate: 0, backgroundColor: '#FF0000' }, + { opacity: 0.5, rotate: 45, backgroundColor: '#00FF00' }, + { opacity: 0.0, rotate: 90, backgroundColor: '#FF0000' }, + ], + 5000, + () => { + this.clearAnimation( + '#container', + { opacity: true, rotate: true }, + function() { + console.log('清除了#container上的opacity和rotate属性') + }, + ) + }, + ) + + this.animate( + '.block', + [ + { scale: [1, 1], rotate: 0, ease: 'ease-out' }, + { scale: [1.5, 1.5], rotate: 45, ease: 'ease-in', offset: 0.9 }, + { scale: [2, 2], rotate: 90 }, + ], + 5000, + () => { + this.clearAnimation('.block', function() { + console.log('清除了.block上的所有动画属性') + }) + }, + ) + }, + }, +}) + +Component({ + methods: { + animate() { + this.animate( + '.avatar', + [ + { + borderRadius: '0', + borderColor: 'red', + transform: 'scale(1) translateY(-20px)', + offset: 0, + }, + { + borderRadius: '25%', + borderColor: 'blue', + transform: 'scale(.65) translateY(-20px)', + offset: 0.5, + }, + { + borderRadius: '50%', + borderColor: 'blue', + transform: `scale(.3) translateY(-20px)`, + offset: 1, + }, + ], + 2000, + { + scrollSource: '#scroller', + timeRange: 2000, + startScrollOffset: 0, + endScrollOffset: 85, + }, + ) + + this.animate( + '.search_input', + [ + { + opacity: '0', + width: '0%', + }, + { + opacity: '1', + width: '100%', + }, + ], + 1000, + { + scrollSource: '#scroller', + timeRange: 1000, + startScrollOffset: 120, + endScrollOffset: 252, + }, + ) + }, + }, +}) diff --git a/test/issue.test.ts b/test/issue.test.ts index 4afcb32..f7a8b7b 100644 --- a/test/issue.test.ts +++ b/test/issue.test.ts @@ -238,7 +238,7 @@ import WX = WechatMiniprogram takePhoto() { this.ctx.takePhoto({ quality: 'high', - success: (res) => { + success: res => { expectType(res.tempImagePath) this.setData({ src: res.tempImagePath, @@ -248,7 +248,7 @@ import WX = WechatMiniprogram }, startRecord() { this.ctx.startRecord({ - success: (res) => { + success: res => { expectType(res.errMsg) console.log('startRecord') }, @@ -256,7 +256,7 @@ import WX = WechatMiniprogram }, stopRecord() { this.ctx.stopRecord({ - success: (res) => { + success: res => { expectType(res.tempThumbPath) expectType(res.tempVideoPath) this.setData({ diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index e1bf839..90beb2b 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -150,17 +150,6 @@ declare namespace WechatMiniprogram { /** 工作电话 */ workPhoneNumber?: string } - /** 广播自定义参数 */ - interface AdvertiseReqObj { - /** 当前Service是否可连接 */ - connectable?: boolean - /** 广播中deviceName字段,默认为当前设备名 */ - deviceName?: string - /** 广播的制造商信息, 默认为空 */ - manufacturerData?: ManufacturerData[] - /** 要广播的serviceUuid列表 */ - serviceUuids?: string[] - } /** 动画效果 */ interface AnimationOption { /** 动画变化时间,单位 ms */ @@ -234,8 +223,6 @@ declare namespace WechatMiniprogram { 'scope.invoiceTitle'?: boolean /** 是否授权录音功能,对应接口 [wx.startRecord](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.startRecord.html) */ 'scope.record'?: boolean - /** 是否授权订阅消息推送功能,对应接口 [wx.requestSubscribeMessage](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html) */ - 'scope.subscribeMessage'?: boolean /** 是否授权用户信息,对应接口 [wx.getUserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html) */ 'scope.userInfo'?: boolean /** 是否授权地理位置,对应接口 [wx.getLocation](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html), [wx.chooseLocation](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.chooseLocation.html) */ @@ -258,21 +245,10 @@ declare namespace WechatMiniprogram { /** 设备特征值列表 */ interface BLECharacteristic { /** 该特征值支持的操作类型 */ - properties: BLECharacteristicProperties + properties: Properties /** 蓝牙设备特征值的 uuid */ uuid: string } - /** 该特征值支持的操作类型 */ - interface BLECharacteristicProperties { - /** 该特征值是否支持 indicate 操作 */ - indicate: boolean - /** 该特征值是否支持 notify 操作 */ - notify: boolean - /** 该特征值是否支持 read 操作 */ - read: boolean - /** 该特征值是否支持 write 操作 */ - write: boolean - } /** 设备服务列表 */ interface BLEService { /** 该服务是否为主服务 */ @@ -609,41 +585,6 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb tempFilePath: string errMsg: string } - /** characteristics列表 */ - interface Characteristic { - /** Characteristic 的 uuid */ - uuid: string - /** 描述符数据 */ - descriptors?: Descriptor - /** 特征值权限 */ - permission?: CharacteristicPermission - /** 特征值支持的操作 */ - properties?: CharacteristicProperties - /** 特征值对应的二进制值 */ - value?: ArrayBuffer - } - /** 特征值权限 */ - interface CharacteristicPermission { - /** 加密读请求 */ - readEncryptionRequired?: boolean - /** 可读 */ - readable?: boolean - /** 加密写请求 */ - writeEncryptionRequired?: boolean - /** 可写 */ - writeable?: boolean - } - /** 特征值支持的操作 */ - interface CharacteristicProperties { - /** 回包 */ - indicate?: boolean - /** 订阅 */ - notify?: boolean - /** 读 */ - read?: boolean - /** 写 */ - write?: boolean - } interface CheckIsSoterEnrolledInDeviceOption { /** 认证方式 * @@ -853,6 +794,12 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb fail?: ChooseMediaFailCallback /** 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至 30s 之间 */ maxDuration?: number + /** 文件类型 + * + * 可选值: + * - 'image': 只能拍摄图片或从相册选择图片; + * - 'video': 只能拍摄视频或从相册选择视频; */ + mediaType?: Array<'image' | 'video'> /** 仅对 mediaType 为 image 时有效,是否压缩所选文件 */ sizeType?: string[] /** 图片和视频选择的来源 @@ -1316,22 +1263,6 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 字体粗细,可选值为 normal / bold / 100 / 200../ 900 */ weight?: string } - /** 描述符数据 */ - interface Descriptor { - /** Descriptor 的 uuid */ - uuid: string - /** 描述符的权限 */ - permission?: DescriptorPermission - /** 描述符数据 */ - value?: ArrayBuffer - } - /** 描述符的权限 */ - interface DescriptorPermission { - /** 读 */ - read?: boolean - /** 写 */ - write?: boolean - } /** 指定 marker 移动到的目标点 */ interface DestinationOption { /** 纬度 */ @@ -1973,7 +1904,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb success?: GetSettingSuccessCallback /** 是否同时获取用户订阅消息的订阅状态,默认不获取 * - * 最低基础库: `2.10.0` */ + * 最低基础库: `2.10.1` */ withSubscriptions?: boolean } interface GetSettingSuccessCallbackResult { @@ -1981,10 +1912,12 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb * * 用户授权结果 */ authSetting: AuthSetting - /** 用户订阅消息(包括一次性订阅消息和系统订阅消息)的订阅状态,需要接口参数withSubscriptions值为true时才会返回。subscriptionsSetting对象的键为**一次性订阅消息的模板id**或**系统订阅消息的类型**,值为'accept'、'reject'、'ban'中的其中一种,'accept'表示用户同意订阅该条订阅消息,'reject'表示用户拒绝订阅该订阅消息,'ban'表示已被后台封禁。一次性订阅消息使用方法详见 [wx.requestSubscribeMessage](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html),系统订阅消息(仅小游戏可用)使用方法详见[wx.requestSubscribeSystemMessage](#) + /** [SubscriptionsSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/SubscriptionsSetting.html) * - * 最低基础库: `2.10.0` */ - subscriptionsSetting: IAnyObject + * 用户订阅消息设置,接口参数`withSubscriptions`值为`true`时才会返回。 + * + * 最低基础库: `2.10.1` */ + subscriptionsSetting: SubscriptionsSetting errMsg: string } interface GetShareInfoOption { @@ -2760,13 +2693,6 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: MakePhoneCallSuccessCallback } - /** 广播的制造商信息, 默认为空 */ - interface ManufacturerData { - /** 制造商ID */ - manufacturerId: string - /** 制造商信息 */ - manufacturerSpecificData: ArrayBuffer - } /** 要显示在可视区域内的坐标点列表 */ interface MapPostion { /** 纬度 */ @@ -2995,14 +2921,6 @@ innerAudioContext.onError((res) => { /** 蓝牙设备ID */ deviceId: string } - interface OnBLEPeripheralConnectionStateChangedCallbackResult { - /** 连接目前状态 */ - connected: boolean - /** 连接状态变化的设备 id */ - deviceId: string - /** server 的 uuid */ - serverId: string - } interface OnBackgroundFetchDataOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: OnBackgroundFetchDataCompleteCallback @@ -3160,24 +3078,6 @@ innerAudioContext.onError((res) => { * - 'none': 无网络; */ networkType: 'wifi' | '2g' | '3g' | '4g' | 'unknown' | 'none' } - interface OnOnCharacteristicReadRequestCallbackResult { - /** 唯一标识码,调用 writeCharacteristicValue 时使用 */ - callbackId: number - /** characteristic对应的uuid */ - characteristicId: string - /** service对应的uuid */ - serviceId: string - } - interface OnOnCharacteristicWriteRequestCallbackResult { - /** 唯一标识码,调用 writeCharacteristicValue 时使用 */ - callbackId: number - /** characteristic对应的uuid */ - characteristicId: string - /** service对应的uuid */ - serviceId: string - /** 请求写入的特征值数据 */ - value: ArrayBuffer - } interface OnOpenCallbackResult { /** 连接成功的 HTTP 响应 Header * @@ -3222,7 +3122,7 @@ innerAudioContext.onError((res) => { } interface OnUnhandledRejectionCallbackResult { /** 被拒绝的 Promise 对象 */ - promise: string + promise: Promise /** 拒绝原因,一般是一个 Error 对象 */ reason: string } @@ -3421,6 +3321,17 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: PreviewImageSuccessCallback } + /** 该特征值支持的操作类型 */ + interface Properties { + /** 该特征值是否支持 indicate 操作 */ + indicate: boolean + /** 该特征值是否支持 notify 操作 */ + notify: boolean + /** 该特征值是否支持 read 操作 */ + read: boolean + /** 该特征值是否支持 write 操作 */ + write: boolean + } interface ReLaunchOption { /** 需要跳转的应用内页面路径 (代码包路径),路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2' */ url: string @@ -3816,21 +3727,7 @@ innerAudioContext.onError((res) => { errMsg: string } interface RequestSubscribeMessageOption { - /** 需要订阅的消息模板的id的集合,一次调用最多可订阅3条消息(注意:iOS客户端7.0.6版本、Android客户端7.0.7版本之后的一次性订阅/长期订阅才支持多个模板消息,iOS客户端7.0.5版本、Android客户端7.0.6版本之前的一次订阅只支持一个模板消息)消息模板id在[微信公众平台(mp.weixin.qq.com)-功能-订阅消息]中配置 - * - * #### 错误码(errCode) - * | errCode | errMsg | 说明 | - * | ------- | ------------------------------------------------------ | -------------------------------------------------------------- | - * | 10001 | TmplIds can't be empty | 参数传空了 | - * | 10002 | Request list fai | 网络问题,请求消息列表失败 | - * | 10003 | Request subscribe fail | 网络问题,订阅请求发送失败 | - * | 10004 | Invalid template id | 参数类型错误 | - * | 10005 | Cannot show subscribe message UI | 无法展示 UI,一般是小程序这个时候退后台了导致的 | - * | 20001 | No template data return, verify the template id exist | 没有模板数据,一般是模板 ID 不存在 或者和模板类型不对应 导致的 | - * | 20002 | Templates type must be same | 模板消息类型 既有一次性的又有永久的 | - * | 20003 | Templates count out of max bounds | 模板消息数量超过上限 | - * | 20004 | The main switch is switched off | 用户关闭了主开关,无法进行订阅 | - * | 20005 | This mini program was banned from subscribing messages | 小程序被禁封 | */ + /** 需要订阅的消息模板的id的集合,一次调用最多可订阅3条消息(注意:iOS客户端7.0.6版本、Android客户端7.0.7版本之后的一次性订阅/长期订阅才支持多个模板消息,iOS客户端7.0.5版本、Android客户端7.0.6版本之前的一次订阅只支持一个模板消息)消息模板id在[微信公众平台(mp.weixin.qq.com)-功能-订阅消息]中配置 */ tmplIds: any[] /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: RequestSubscribeMessageCompleteCallback @@ -4089,13 +3986,6 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: SendSocketMessageSuccessCallback } - /** 描述service的Object */ - interface Service { - /** characteristics列表 */ - characteristics: Characteristic[] - /** service 的 uuid */ - uuid: string - } interface SetBGMVolumeOption { /** 音量大小,范围是 0-1 */ volume: string @@ -4412,6 +4302,8 @@ innerAudioContext.onError((res) => { success?: ShowNavigationBarLoadingSuccessCallback } interface ShowRedPackageOption { + /** 封面地址 */ + url: string /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: ShowRedPackageCompleteCallback /** 接口调用失败的回调函数 */ @@ -4521,16 +4413,6 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: StartAccelerometerSuccessCallback } - interface StartAdvertisingObject { - /** 广播自定义参数 */ - advertiseRequest: AdvertiseReqObj - /** 广播功率 - * - * 可选值: - * - 'low': 功率低; - * - 'medium': 功率适中; */ - powerLevel?: 'low' | 'medium' - } interface StartBeaconDiscoveryOption { /** iBeacon 设备广播的 uuid 列表 */ uuids: string[] @@ -4904,6 +4786,13 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: StopWifiSuccessCallback } + /** 订阅消息设置 */ + interface SubscriptionsSetting { + /** 每一项订阅消息的订阅状态。itemSettings对象的键为**一次性订阅消息的模板id**或**系统订阅消息的类型**,值为'accept'、'reject'、'ban'中的其中一种。'accept'表示用户同意订阅这条消息,'reject'表示用户拒绝订阅这条消息,'ban'表示已被后台封禁。一次性订阅消息使用方法详见 [wx.requestSubscribeMessage](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html),永久订阅消息(仅小游戏可用)使用方法详见[wx.requestSubscribeSystemMessage](#) */ + itemSettings: IAnyObject + /** 订阅消息总开关,true为开启,false为关闭 */ + mainSwitch: boolean + } interface SwitchCameraOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: SwitchCameraCompleteCallback @@ -5214,18 +5103,6 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: WriteBLECharacteristicValueSuccessCallback } - interface WriteCharacteristicValueObject { - /** 可选,处理回包时使用 */ - callbackId: number - /** characteristic对应的uuid */ - characteristicId: string - /** 是否需要通知主机value已更新 */ - needNotify: boolean - /** service 的 uuid */ - serviceId: string - /** 特征值对应的二进制值 */ - value: ArrayBuffer - } interface WriteFileFailCallbackResult { /** 错误信息 * @@ -5607,68 +5484,6 @@ innerAudioContext.onError((res) => { src: string, ): void } - interface BLEPeripheralServer { - /** [BLEPeripheralServer.offOnCharacteristicReadRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.offOnCharacteristicReadRequest.html) - * - * 取消监听已连接的设备请求读当前外围设备的特征值事件 */ - offOnCharacteristicReadRequest( - /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ - callback: OffOnCharacteristicReadRequestCallback, - ): void - /** [BLEPeripheralServer.offOnCharacteristicWriteRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.offOnCharacteristicWriteRequest.html) - * - * 取消监听已连接的设备请求读当前外围设备的特征值事件 */ - offOnCharacteristicWriteRequest( - /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ - callback: OffOnCharacteristicWriteRequestCallback, - ): void - /** [BLEPeripheralServer.onOnCharacteristicReadRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.onOnCharacteristicReadRequest.html) - * - * 监听已连接的设备请求读当前外围设备的特征值事件。收到该消息后需要立刻调用 `writeCharacteristicValue` 写回数据,否则主机不会收到响应 */ - onOnCharacteristicReadRequest( - /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ - callback: OnOnCharacteristicReadRequestCallback, - ): void - /** [BLEPeripheralServer.onOnCharacteristicWriteRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.onOnCharacteristicWriteRequest.html) - * - * 监听已连接的设备请求读当前外围设备的特征值事件。收到该消息后需要立刻调用 `writeCharacteristicValue` 写回数据,否则主机不会收到响应 */ - onOnCharacteristicWriteRequest( - /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ - callback: OnOnCharacteristicWriteRequestCallback, - ): void - /** [Promise BLEPeripheralServer.addService(Object service)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.addService.html) - * - * 添加服务 */ - addService( - /** 描述service的Object */ - service: Service, - ): Promise - /** [Promise BLEPeripheralServer.close()](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.close.html) - * - * 关闭当前服务端 */ - close(): Promise - /** [Promise BLEPeripheralServer.removeService(String serviceId)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.removeService.html) - * - * 移除服务 */ - removeService( - /** service 的 uuid */ - serviceId: string, - ): Promise - /** [Promise BLEPeripheralServer.startAdvertising(Object Object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.startAdvertising.html) - * - * 开始广播本地创建的外围设备 */ - startAdvertising(Object: StartAdvertisingObject): Promise - /** [Promise BLEPeripheralServer.stopAdvertising()](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.stopAdvertising.html) - * - * 停止广播 */ - stopAdvertising(): Promise - /** [Promise BLEPeripheralServer.writeCharacteristicValue(Object Object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.writeCharacteristicValue.html) - * - * 往指定特征值写入数据,并通知已连接的主机,从机的特征值已发生变化,该接口会处理是走回包还是走订阅 */ - writeCharacteristicValue( - Object: WriteCharacteristicValueObject, - ): Promise - } interface BackgroundAudioError { /** 错误信息 * @@ -9431,7 +9246,7 @@ console.log(accountInfo.plugin.version) // 插件版本号, 'a.b.c' 这样的 * 部分版本在无 `referrerInfo` 的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。 * * 最低基础库: `2.9.4` */ - getEnterOptionsSync(): undefined + getEnterOptionsSync(): LaunchOptionsApp /** [Object wx.getExtConfigSync()](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfigSync.html) * * [wx.getExtConfig](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfig.html) 的同步版本。 @@ -10196,11 +10011,14 @@ wx.chooseInvoiceTitle({ * * ```js wx.chooseMedia({ - sourceType: ['album','camera'], + count: 9, + mediaType: ['image','video'], + sourceType: ['album', 'camera'], maxDuration: 30, camera: 'back', success(res) { console.log(res.tempFilePath) + console.log(res.size) } }) ``` @@ -10812,14 +10630,17 @@ wx.getSetting({ console.log(res.authSetting) // res.authSetting = { // "scope.userInfo": true, - // "scope.subscribeMessage": true + // "scope.userLocation": true // } console.log(res.subscriptionsSetting) // res.subscriptionsSetting = { - // SYS_MSG_TYPE_INTERACTIVE: 'accept', - // SYS_MSG_TYPE_RANK: 'accept', - // zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: 'reject', - // ke_OZC_66gZxALLcsuI7ilCJSP2OJ2vWo2ooUPpkWrw: 'ban', + // mainSwitch: true, // 订阅消息总开关 + // itemSettings: { // 每一项开关 + // SYS_MSG_TYPE_INTERACTIVE: 'accept', // 小游戏系统订阅消息 + // SYS_MSG_TYPE_RANK: 'accept' + // zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: 'reject', // 普通一次性订阅消息 + // ke_OZC_66gZxALLcsuI7ilCJSP2OJ2vWo2ooUPpkWrw: 'ban', + // } // } } }) @@ -10846,7 +10667,8 @@ wx.getSetting({ * **Tips** * * -* - 如需要展示群名称,可以使用[开放数据组件](https://developers.weixin.qq.com/miniprogram/dev/component/open-ability/open-data.html) +* - 如需要展示群名称,小程序可以使用[开放数据组件](https://developers.weixin.qq.com/miniprogram/dev/component/open-ability/open-data.html) +* - 小游戏可以通过 `wx.getGroupInfo` 接口获取群名称 * * 最低基础库: `1.1.0` */ getShareInfo(option: GetShareInfoOption): void @@ -11448,13 +11270,6 @@ wx.notifyBLECharacteristicValueChange({ /** 低功耗蓝牙连接状态的改变事件的回调函数 */ callback: (...args: any[]) => any, ): void - /** [wx.offBLEPeripheralConnectionStateChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBLEPeripheralConnectionStateChanged.html) - * - * 取消监听当前外围设备被连接或断开连接事件 */ - offBLEPeripheralConnectionStateChanged( - /** 当前外围设备被连接或断开连接事件的回调函数 */ - callback: OffBLEPeripheralConnectionStateChangedCallback, - ): void /** [wx.offBeaconServiceChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconServiceChange.html) * * 取消监听 iBeacon 服务状态变化事件 @@ -11780,13 +11595,6 @@ wx.onBLEConnectionStateChange(function(res) { /** 低功耗蓝牙连接状态的改变事件的回调函数 */ callback: OnBLEConnectionStateChangeCallback, ): void - /** [wx.onBLEPeripheralConnectionStateChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBLEPeripheralConnectionStateChanged.html) - * - * 监听当前外围设备被连接或断开连接事件 */ - onBLEPeripheralConnectionStateChanged( - /** 当前外围设备被连接或断开连接事件的回调函数 */ - callback: OnBLEPeripheralConnectionStateChangedCallback, - ): void /** [wx.onBackgroundAudioPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioPause.html) * * 监听音乐暂停事件。 */ @@ -12615,11 +12423,30 @@ wx.requestPayment({ requestPayment(option: RequestPaymentOption): void /** [wx.requestSubscribeMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html) * -* 调起客户端小程序订阅消息界面,返回用户订阅消息的操作结果。 +* 调起客户端小程序订阅消息界面,返回用户订阅消息的操作结果。当用户勾选了订阅面板中的“总是保持以上选择,不再询问”时,模板消息会被添加到用户的小程序设置页,通过 [wx.getSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.getSetting.html) 接口可获取用户对相关模板消息的订阅状态。 +* +* ## 注意事项 +* - 一次性模板 id 和永久模板 id 不可同时使用。 +* - 低版本基础库2.4.4~2.8.3 已支持订阅消息接口调用,仅支持传入一个一次性 tmplId / 永久 tmplId。 +* - [2.8.2](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为或者发起支付回调后,才可以调起订阅消息界面。 +* - [2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,开发版和体验版小程序将禁止使用模板消息 fomrId。 +* +* **错误码** * -* 注意:[2.8.2](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为或者发起支付回调后,才可以调起订阅消息界面。 * -* 当用户勾选了订阅面板中的“总是保持以上选择,不再询问”时,模板消息会被添加到用户的小程序设置页,通过 [wx.getSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.getSetting.html) 接口可获取用户对相关模板消息的订阅状态。 +* +* | errCode | errMsg | 说明 | +* | ------- | ------------------------------------------------------ | -------------------------------------------------------------- | +* | 10001 | TmplIds can't be empty | 参数传空了 | +* | 10002 | Request list fai | 网络问题,请求消息列表失败 | +* | 10003 | Request subscribe fail | 网络问题,订阅请求发送失败 | +* | 10004 | Invalid template id | 参数类型错误 | +* | 10005 | Cannot show subscribe message UI | 无法展示 UI,一般是小程序这个时候退后台了导致的 | +* | 20001 | No template data return, verify the template id exist | 没有模板数据,一般是模板 ID 不存在 或者和模板类型不对应 导致的 | +* | 20002 | Templates type must be same | 模板消息类型 既有一次性的又有永久的 | +* | 20003 | Templates count out of max bounds | 模板消息数量超过上限 | +* | 20004 | The main switch is switched off | 用户关闭了主开关,无法进行订阅 | +* | 20005 | This mini program was banned from subscribing messages | 小程序被禁封 | * * **示例代码** * @@ -13153,14 +12980,12 @@ wx.showModal({ * * 在当前页面显示导航条加载动画 */ showNavigationBarLoading(option?: ShowNavigationBarLoadingOption): void - /** [wx.showRedPackage(Object object, number url)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/redpackage/wx.showRedPackage.html) + /** [wx.showRedPackage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/redpackage/wx.showRedPackage.html) * - * 拉取h5领取红包封面页 */ - showRedPackage( - option: ShowRedPackageOption, - /** 红包封面地址 */ - url?: number, - ): void + * 拉取h5领取红包封面页。获取参考红包封面地址参考 [微信红包封面开发平台](https://cover.weixin.qq.com/cgi-bin/mmcover-bin/readtemplate?t=page%2Fdoc%2Fguide%2Fintroduce.html)。 + * + * 最低基础库: `2.10.0` */ + showRedPackage(option: ShowRedPackageOption): void /** [wx.showShareMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.showShareMenu.html) * * 显示当前页面的转发按钮 @@ -14769,10 +14594,6 @@ wx.writeBLECharacteristicValue({ ) => void /** 音频中断结束事件的回调函数 */ type OffAudioInterruptionEndCallback = (res: GeneralCallbackResult) => void - /** 当前外围设备被连接或断开连接事件的回调函数 */ - type OffBLEPeripheralConnectionStateChangedCallback = ( - res: GeneralCallbackResult, - ) => void /** iBeacon 服务状态变化事件的回调函数 */ type OffBeaconServiceChangeCallback = (res: GeneralCallbackResult) => void /** iBeacon 设备更新事件的回调函数 */ @@ -14799,14 +14620,6 @@ wx.writeBLECharacteristicValue({ type OffLocationChangeCallback = (res: GeneralCallbackResult) => void /** 收到消息的事件的回调函数 */ type OffMessageCallback = (res: GeneralCallbackResult) => void - /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ - type OffOnCharacteristicReadRequestCallback = ( - res: GeneralCallbackResult, - ) => void - /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ - type OffOnCharacteristicWriteRequestCallback = ( - res: GeneralCallbackResult, - ) => void /** 小程序要打开的页面不存在事件的回调函数 */ type OffPageNotFoundCallback = (res: GeneralCallbackResult) => void /** 音频暂停事件的回调函数 */ @@ -14852,10 +14665,6 @@ wx.writeBLECharacteristicValue({ type OnBLEConnectionStateChangeCallback = ( result: OnBLEConnectionStateChangeCallbackResult, ) => void - /** 当前外围设备被连接或断开连接事件的回调函数 */ - type OnBLEPeripheralConnectionStateChangedCallback = ( - result: OnBLEPeripheralConnectionStateChangedCallbackResult, - ) => void /** 音乐暂停事件的回调函数 */ type OnBackgroundAudioPauseCallback = (res: GeneralCallbackResult) => void /** 音乐播放事件的回调函数 */ @@ -14953,14 +14762,6 @@ wx.writeBLECharacteristicValue({ ) => void /** 用户在系统音乐播放面板点击下一曲事件的回调函数 */ type OnNextCallback = (res: GeneralCallbackResult) => void - /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ - type OnOnCharacteristicReadRequestCallback = ( - result: OnOnCharacteristicReadRequestCallbackResult, - ) => void - /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ - type OnOnCharacteristicWriteRequestCallback = ( - result: OnOnCharacteristicWriteRequestCallbackResult, - ) => void /** WebSocket 连接打开事件的回调函数 */ type OnOpenCallback = (result: OnOpenCallbackResult) => void /** 小程序要打开的页面不存在事件的回调函数 */ diff --git a/types/wx/lib.wx.app.d.ts b/types/wx/lib.wx.app.d.ts index 1668b46..56b0bd9 100644 --- a/types/wx/lib.wx.app.d.ts +++ b/types/wx/lib.wx.app.d.ts @@ -231,6 +231,11 @@ declare namespace WechatMiniprogram { * 最低基础库: 1.9.90 */ onPageNotFound(options: PageNotFoundOption): void + /** + * 小程序有未处理的 Promise 拒绝时触发。也可以使用 [wx.onUnhandledRejection](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html) 绑定监听。注意事项请参考 [wx.onUnhandledRejection](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html)。 + * **参数**:与 [wx.onUnhandledRejection](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html) 一致 + */ + onUnhandledRejection: OnUnhandledRejectionCallback } type Instance = Option & T diff --git a/types/wx/lib.wx.component.d.ts b/types/wx/lib.wx.component.d.ts index 79e1b44..f46108f 100644 --- a/types/wx/lib.wx.component.d.ts +++ b/types/wx/lib.wx.component.d.ts @@ -68,8 +68,7 @@ declare namespace WechatMiniprogram { properties: P } interface Method { - /** object组件的方法,包括事件响应函数和任意的自定义方法,关于事件响应函数的使用,参见 [组件事件](events.md) */ - + /** 组件的方法,包括事件响应函数和任意的自定义方法,关于事件响应函数的使用,参见 [组件间通信与事件](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/events.html) */ methods: M } type PropertyType = @@ -179,14 +178,70 @@ declare namespace WechatMiniprogram { selectComponent(selector: string): TrivialInstance /** 使用选择器选择组件实例节点,返回匹配到的全部组件实例对象组成的数组 */ selectAllComponents(selector: string): TrivialInstance[] + /** + * 选取当前组件节点所在的组件实例(即组件的引用者),返回它的组件实例对象(会被 `wx://component-export` 影响) + * + * 最低基础库版本:[`2.8.2`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + **/ + selectOwnerComponent(): TrivialInstance /** 获取这个关系所对应的所有关联节点,参见 组件间关系 */ getRelationNodes(relationKey: string): TrivialInstance[] - /** 立刻执行 callback ,其中的多个 setData 之间不会触发界面绘制(只有某些特殊场景中需要,如用于在不同组件同时 setData 时进行界面绘制同步)*/ + /** + * 立刻执行 callback ,其中的多个 setData 之间不会触发界面绘制(只有某些特殊场景中需要,如用于在不同组件同时 setData 时进行界面绘制同步) + * + * 最低基础库版本:[`2.4.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + **/ groupSetData(callback?: () => void): void - /** 返回当前页面的 custom-tab-bar 的组件实例 */ + /** + * 返回当前页面的 custom-tab-bar 的组件实例 + * + * 最低基础库版本:[`2.6.2`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + **/ getTabBar(): TrivialInstance - /** 返回页面标识符(一个字符串),可以用来判断几个自定义组件实例是不是在同一个页面内 */ + /** + * 返回页面标识符(一个字符串),可以用来判断几个自定义组件实例是不是在同一个页面内 + * + * 最低基础库版本:[`2.7.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + **/ getPageId(): string + /** + * 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) + * + * 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + **/ + animate( + selector: string, + keyFrames: KeyFrame[], + duration: number, + callback: () => void, + ): void + /** + * 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) + * + * 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + **/ + animate( + selector: string, + keyFrames: ScrollTimelineKeyframe[], + duration: number, + scrollTimeline: ScrollTimelineOption, + ): void + /** + * 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) + * + * 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + **/ + clearAnimation(selector: string, callback: () => void): void + /** + * 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) + * + * 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + **/ + clearAnimation( + selector: string, + options: ClearAnimationOptions, + callback: () => void, + ): void } interface ComponentOptions { @@ -276,7 +331,7 @@ declare namespace WechatMiniprogram { * 最低基础库: `2.2.3` */ lifetimes: Partial<{ /** - * 在组件实例刚刚被创建时执行 + * 在组件实例刚刚被创建时执行,注意此时不能调用 `setData` * * 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) */ @@ -363,28 +418,175 @@ declare namespace WechatMiniprogram { } interface OtherOption { - /** 类似于mixins和traits的组件间代码复用机制,参见 [behaviors](behaviors.md) */ + /** 类似于mixins和traits的组件间代码复用机制,参见 [behaviors](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/behaviors.html) */ behaviors: string[] - /** 组件数据字段监听器,用于监听 properties 和 data 的变化 */ + /** + * 组件数据字段监听器,用于监听 properties 和 data 的变化,参见 [数据监听器](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/observer.html) + * + * 最低基础库版本:[`2.6.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + */ observers: Record any> - /** 组件间关系定义,参见 [组件间关系](relations.md) */ + /** 组件间关系定义,参见 [组件间关系](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/lifetimes.html) */ relations: { [componentName: string]: RelationOption, } - /** 组件接受的外部样式类,参见 [外部样式类](wxml-wxss.md) */ + /** 组件接受的外部样式类,参见 [外部样式类](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html) */ externalClasses?: string[] - /** 组件所在页面的生命周期声明对象,目前仅支持页面的 `show` 和 `hide` 两个生命周期 + /** 组件所在页面的生命周期声明对象,参见 [组件生命周期](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/lifetimes.html) * - * 最低基础库: `2.2.3` */ + * 最低基础库版本: [`2.2.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) */ pageLifetimes?: Partial /** 一些选项(文档中介绍相关特性时会涉及具体的选项设置,这里暂不列举) */ options: ComponentOptions - /** 定义段过滤器,用于自定义组件扩展,参见 [自定义组件扩展](extend.md) + /** 定义段过滤器,用于自定义组件扩展,参见 [自定义组件扩展](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/extend.html) * - * 最低基础库: `2.2.3` */ + * 最低基础库版本: [`2.2.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) */ definitionFilter?: DefinitionFilter } + + interface KeyFrame { + /** 关键帧的偏移,范围[0-1] */ + offset?: number + /** 动画缓动函数 */ + ease?: string + /** 基点位置,即 CSS transform-origin */ + transformOrigin?: string + /** 背景颜色,即 CSS background-color */ + backgroundColor?: string + /** 底边位置,即 CSS bottom */ + bottom?: number | string + /** 高度,即 CSS height */ + height?: number | string + /** 左边位置,即 CSS left */ + left?: number | string + /** 宽度,即 CSS width */ + width?: number | string + /** 不透明度,即 CSS opacity */ + opacity?: number | string + /** 右边位置,即 CSS right */ + right?: number | string + /** 顶边位置,即 CSS top */ + top?: number | string + /** 变换矩阵,即 CSS transform matrix */ + matrix?: number[] + /** 三维变换矩阵,即 CSS transform matrix3d */ + matrix3d?: number[] + /** 旋转,即 CSS transform rotate */ + rotate?: number + /** 三维旋转,即 CSS transform rotate3d */ + rotate3d?: number[] + /** X 方向旋转,即 CSS transform rotateX */ + rotateX?: number + /** Y 方向旋转,即 CSS transform rotateY */ + rotateY?: number + /** Z 方向旋转,即 CSS transform rotateZ */ + rotateZ?: number + /** 缩放,即 CSS transform scale */ + scale?: number[] + /** 三维缩放,即 CSS transform scale3d */ + scale3d?: number[] + /** X 方向缩放,即 CSS transform scaleX */ + scaleX?: number + /** Y 方向缩放,即 CSS transform scaleY */ + scaleY?: number + /** Z 方向缩放,即 CSS transform scaleZ */ + scaleZ?: number + /** 倾斜,即 CSS transform skew */ + skew?: number[] + /** X 方向倾斜,即 CSS transform skewX */ + skewX?: number + /** Y 方向倾斜,即 CSS transform skewY */ + skewY?: number + /** 位移,即 CSS transform translate */ + translate?: Array + /** 三维位移,即 CSS transform translate3d */ + translate3d?: Array + /** X 方向位移,即 CSS transform translateX */ + translateX?: number | string + /** Y 方向位移,即 CSS transform translateY */ + translateY?: number | string + /** Z 方向位移,即 CSS transform translateZ */ + translateZ?: number | string + } + interface ClearAnimationOptions { + /** 基点位置,即 CSS transform-origin */ + transformOrigin?: boolean + /** 背景颜色,即 CSS background-color */ + backgroundColor?: boolean + /** 底边位置,即 CSS bottom */ + bottom?: boolean + /** 高度,即 CSS height */ + height?: boolean + /** 左边位置,即 CSS left */ + left?: boolean + /** 宽度,即 CSS width */ + width?: boolean + /** 不透明度,即 CSS opacity */ + opacity?: boolean + /** 右边位置,即 CSS right */ + right?: boolean + /** 顶边位置,即 CSS top */ + top?: boolean + /** 变换矩阵,即 CSS transform matrix */ + matrix?: boolean + /** 三维变换矩阵,即 CSS transform matrix3d */ + matrix3d?: boolean + /** 旋转,即 CSS transform rotate */ + rotate?: boolean + /** 三维旋转,即 CSS transform rotate3d */ + rotate3d?: boolean + /** X 方向旋转,即 CSS transform rotateX */ + rotateX?: boolean + /** Y 方向旋转,即 CSS transform rotateY */ + rotateY?: boolean + /** Z 方向旋转,即 CSS transform rotateZ */ + rotateZ?: boolean + /** 缩放,即 CSS transform scale */ + scale?: boolean + /** 三维缩放,即 CSS transform scale3d */ + scale3d?: boolean + /** X 方向缩放,即 CSS transform scaleX */ + scaleX?: boolean + /** Y 方向缩放,即 CSS transform scaleY */ + scaleY?: boolean + /** Z 方向缩放,即 CSS transform scaleZ */ + scaleZ?: boolean + /** 倾斜,即 CSS transform skew */ + skew?: boolean + /** X 方向倾斜,即 CSS transform skewX */ + skewX?: boolean + /** Y 方向倾斜,即 CSS transform skewY */ + skewY?: boolean + /** 位移,即 CSS transform translate */ + translate?: boolean + /** 三维位移,即 CSS transform translate3d */ + translate3d?: boolean + /** X 方向位移,即 CSS transform translateX */ + translateX?: boolean + /** Y 方向位移,即 CSS transform translateY */ + translateY?: boolean + /** Z 方向位移,即 CSS transform translateZ */ + translateZ?: boolean + } + interface ScrollTimelineKeyframe { + composite?: 'replace' | 'add' | 'accumulate' | 'auto' + easing?: string + offset?: number | null + [property: string]: string | number | null | undefined + } + interface ScrollTimelineOption { + /** 指定滚动元素的选择器(只支持 scroll-view),该元素滚动时会驱动动画的进度 */ + scrollSource: string + /** 指定滚动的方向。有效值为 horizontal 或 vertical */ + orientation?: string + /** 指定开始驱动动画进度的滚动偏移量,单位 px */ + startScrollOffset: number + /** 指定停止驱动动画进度的滚动偏移量,单位 px */ + endScrollOffset: number + /** 起始和结束的滚动范围映射的时间长度,该时间可用于与关键帧动画里的时间 (duration) 相匹配,单位 ms */ + timeRange: number + } } } /** Component构造器可用于定义组件,调用Component构造器时可以指定组件的属性、数据、方法等。 From 36613f9c94edba9cad52812d8af005e045002811 Mon Sep 17 00:00:00 2001 From: Baran Date: Sat, 1 Feb 2020 17:11:33 +0800 Subject: [PATCH 003/205] =?UTF-8?q?feat(page):=20=E6=9A=B4=E9=9C=B2=20page?= =?UTF-8?q?=20=E7=9A=84=20options?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/wx/lib.wx.page.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/wx/lib.wx.page.d.ts b/types/wx/lib.wx.page.d.ts index 1889b64..c9ce68b 100644 --- a/types/wx/lib.wx.page.d.ts +++ b/types/wx/lib.wx.page.d.ts @@ -127,6 +127,9 @@ declare namespace WechatMiniprogram { /** 到当前页面的路径 */ route: string + + /** 打开当前页面路径中的参数 */ + options: Record } type DataOption = Record From abb25c07af9355a540b7042377f54fed6b7d7ce6 Mon Sep 17 00:00:00 2001 From: SgLy <775150558@qq.com> Date: Mon, 10 Feb 2020 15:20:39 +0800 Subject: [PATCH 004/205] fix: minor fixes, see below close #102 publish #101 --- CHANGELOG.md | 4 ++++ VERSIONS.md | 2 +- package-lock.json | 2 +- package.json | 2 +- types/wx/lib.wx.api.d.ts | 5 +++-- types/wx/lib.wx.app.d.ts | 4 ++-- types/wx/lib.wx.behavior.d.ts | 2 +- types/wx/lib.wx.component.d.ts | 2 +- types/wx/lib.wx.page.d.ts | 6 +++--- 9 files changed, 17 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e60b759..41a173b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2020-02-10 v2.10.1-1 +- 允许重写部分全局变量(由 `const` 改为 `let`)(#102) +- 补齐 `Page` 上的 `options` 字段(#101 by @baranwang) + ## 2020-01-19 v2.10.1 - 同步 API 定义到基础库 2.10.1 - 补齐 `Component` `selectOwnerComponent`, `animate`, `clearAnimation`(#96) diff --git a/VERSIONS.md b/VERSIONS.md index 93118f2..1094089 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -2,7 +2,7 @@ 基础库版本|npm 版本|命令 -|-|- -[v2.10.1](https://developers.weixin.qq.com/miniprogram/dev/framework/release/) | [2.10.1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.1) | `npm install miniprogram-api-typings@2.10.1` +[v2.10.1](https://developers.weixin.qq.com/miniprogram/dev/framework/release/) | [2.10.1-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.1-1) | `npm install miniprogram-api-typings@2.10.1-1` [v2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-0-2019-12-24) | [2.10.0-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.0-1) | `npm install miniprogram-api-typings@2.10.0-1` [v2.9.4](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-9-4-2019-11-28) | [2.9.4](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.4) | `npm install miniprogram-api-typings@2.9.4` [v2.9.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/) | [2.9.3](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.3) | `npm install miniprogram-api-typings@2.9.3` diff --git a/package-lock.json b/package-lock.json index 9c95d8e..fee6f2c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.10.1", + "version": "2.10.1-1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index eebd906..61284ef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.10.1", + "version": "2.10.1-1", "description": "Type definitions for APIs of Wechat Mini Program in TypeScript", "main": "./index.d.ts", "types": "./index.d.ts", diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index 90beb2b..20cbdcf 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -1902,7 +1902,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb fail?: GetSettingFailCallback /** 接口调用成功的回调函数 */ success?: GetSettingSuccessCallback - /** 是否同时获取用户订阅消息的订阅状态,默认不获取 + /** 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。 * * 最低基础库: `2.10.1` */ withSubscriptions?: boolean @@ -11932,7 +11932,8 @@ wx.onNetworkStatusChange(function (res) { * **注意** * * - * 安卓平台暂时不会派发该事件 + * - 安卓平台暂时不支持该事件 + * - 所有的 unhandledRejection 都可以被这一监听捕获,但只有 Error 类型的才会在小程序后台触发报警。 * * 最低基础库: `2.10.0` */ onUnhandledRejection( diff --git a/types/wx/lib.wx.app.d.ts b/types/wx/lib.wx.app.d.ts index 56b0bd9..818becf 100644 --- a/types/wx/lib.wx.app.d.ts +++ b/types/wx/lib.wx.app.d.ts @@ -262,5 +262,5 @@ declare namespace WechatMiniprogram { } } -declare const App: WechatMiniprogram.App.Constructor -declare const getApp: WechatMiniprogram.App.GetApp +declare let App: WechatMiniprogram.App.Constructor +declare let getApp: WechatMiniprogram.App.GetApp diff --git a/types/wx/lib.wx.behavior.d.ts b/types/wx/lib.wx.behavior.d.ts index 4a52274..e5fcea1 100644 --- a/types/wx/lib.wx.behavior.d.ts +++ b/types/wx/lib.wx.behavior.d.ts @@ -63,4 +63,4 @@ declare namespace WechatMiniprogram { } } /** 注册一个 `behavior`,接受一个 `Object` 类型的参数。*/ -declare const Behavior: WechatMiniprogram.Behavior.Constructor +declare let Behavior: WechatMiniprogram.Behavior.Constructor diff --git a/types/wx/lib.wx.component.d.ts b/types/wx/lib.wx.component.d.ts index f46108f..9b7e2fa 100644 --- a/types/wx/lib.wx.component.d.ts +++ b/types/wx/lib.wx.component.d.ts @@ -598,4 +598,4 @@ declare namespace WechatMiniprogram { * * 从基础库 `2.0.9` 开始,对象类型的属性和 data 字段中可以包含函数类型的子字段,即可以通过对象类型的属性字段来传递函数。低于这一版本的基础库不支持这一特性。 * * `bug` : 对于 type 为 Object 或 Array 的属性,如果通过该组件自身的 `this.setData` 来改变属性值的一个子字段,则依旧会触发属性 observer ,且 observer 接收到的 `newVal` 是变化的那个子字段的值, `oldVal` 为空, `changedPath` 包含子字段的字段名相关信息。 */ -declare const Component: WechatMiniprogram.Component.Constructor +declare let Component: WechatMiniprogram.Component.Constructor diff --git a/types/wx/lib.wx.page.d.ts b/types/wx/lib.wx.page.d.ts index c9ce68b..5397b14 100644 --- a/types/wx/lib.wx.page.d.ts +++ b/types/wx/lib.wx.page.d.ts @@ -127,7 +127,7 @@ declare namespace WechatMiniprogram { /** 到当前页面的路径 */ route: string - + /** 打开当前页面路径中的参数 */ options: Record } @@ -215,7 +215,7 @@ declare namespace WechatMiniprogram { /** * 注册小程序中的一个页面。接受一个 `Object` 类型参数,其指定页面的初始数据、生命周期回调、事件处理函数等。 */ -declare const Page: WechatMiniprogram.Page.Constructor +declare let Page: WechatMiniprogram.Page.Constructor /** * 获取当前页面栈。数组中第一个元素为首页,最后一个元素为当前页面。 @@ -224,4 +224,4 @@ declare const Page: WechatMiniprogram.Page.Constructor * - __不要尝试修改页面栈,会导致路由以及页面状态错误。__ * - 不要在 `App.onLaunch` 的时候调用 `getCurrentPages()`,此时 `page` 还没有生成。 */ -declare const getCurrentPages: WechatMiniprogram.Page.getCurrentPages +declare let getCurrentPages: WechatMiniprogram.Page.getCurrentPages From f9af0f889bc66b103d9283ec104d10437aea706b Mon Sep 17 00:00:00 2001 From: SgLy <775150558@qq.com> Date: Fri, 6 Mar 2020 17:40:45 +0800 Subject: [PATCH 005/205] feat(baselib): definition for 2.10.2 --- CHANGELOG.md | 3 + VERSIONS.md | 3 +- package-lock.json | 2 +- package.json | 2 +- types/wx/lib.wx.api.d.ts | 176 +++++++++++++++++++++++++++------------ 5 files changed, 130 insertions(+), 56 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41a173b..510bf35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2020-03-06 v2.10.2 +- 同步 API 定义到基础库 2.10.2 + ## 2020-02-10 v2.10.1-1 - 允许重写部分全局变量(由 `const` 改为 `let`)(#102) - 补齐 `Page` 上的 `options` 字段(#101 by @baranwang) diff --git a/VERSIONS.md b/VERSIONS.md index 1094089..903d583 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -2,7 +2,8 @@ 基础库版本|npm 版本|命令 -|-|- -[v2.10.1](https://developers.weixin.qq.com/miniprogram/dev/framework/release/) | [2.10.1-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.1-1) | `npm install miniprogram-api-typings@2.10.1-1` +[v2.10.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-2-2020-02-20) | [2.10.2](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.2) | `npm install miniprogram-api-typings@2.10.2` +[v2.10.1](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-1-2020-01-14) | [2.10.1-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.1-1) | `npm install miniprogram-api-typings@2.10.1-1` [v2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-0-2019-12-24) | [2.10.0-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.0-1) | `npm install miniprogram-api-typings@2.10.0-1` [v2.9.4](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-9-4-2019-11-28) | [2.9.4](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.4) | `npm install miniprogram-api-typings@2.9.4` [v2.9.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/) | [2.9.3](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.3) | `npm install miniprogram-api-typings@2.9.3` diff --git a/package-lock.json b/package-lock.json index fee6f2c..e9f929d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.10.1-1", + "version": "2.10.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 61284ef..a27e05f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.10.1-1", + "version": "2.10.2", "description": "Type definitions for APIs of Wechat Mini Program in TypeScript", "main": "./index.d.ts", "types": "./index.d.ts", diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index 20cbdcf..0cfd67e 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -1412,7 +1412,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb } interface FileSystemManagerSaveFileSuccessCallbackResult { /** 存储后的文件路径 (本地路径) */ - savedFilePath: number + savedFilePath: string errMsg: string } interface GetAvailableAudioSourcesOption { @@ -1664,6 +1664,15 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 接口调用成功的回调函数 */ success?: GetContentsSuccessCallback } + interface GetContentsSuccessCallbackResult { + /** 表示内容的delta对象 */ + delta: IAnyObject + /** 带标签的HTML内容 */ + html: string + /** 纯文本内容 */ + text: string + errMsg: string + } interface GetExtConfigOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: GetExtConfigCompleteCallback @@ -1895,6 +1904,19 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb start: number errMsg: string } + interface GetSelectionTextOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetSelectionTextCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetSelectionTextFailCallback + /** 接口调用成功的回调函数 */ + success?: GetSelectionTextSuccessCallback + } + interface GetSelectionTextSuccessCallbackResult { + /** 纯文本内容 */ + text: string + errMsg: string + } interface GetSettingOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: GetSettingCompleteCallback @@ -2745,6 +2767,10 @@ innerAudioContext.onError((res) => { * * 最低基础库: `2.10.0` */ envVersion: 'develop' | 'trial' | 'release' + /** 线上小程序版本号 + * + * 最低基础库: `2.10.2` */ + version: string } interface MkdirFailCallbackResult { /** 错误信息 @@ -3642,7 +3668,15 @@ innerAudioContext.onError((res) => { * **** * * - 通过 Canvas.getContext('2d') 接口可以获取 CanvasRenderingContext2D 对象,实现了 [HTML Canvas 2D Context](https://www.w3.org/TR/2dcontext/) 定义的属性、方法。 - * - 通过 Canvas.getContext('webgl') 或 OffscreenCanvas.getContext('webgl') 接口可以获取 WebGLRenderingContext 对象,实现了 [WebGL 1.0](https://www.khronos.org/registry/webgl/specs/latest/1.0/) 定义的所有属性、方法、常量。 */ + * - 通过 Canvas.getContext('webgl') 或 OffscreenCanvas.getContext('webgl') 接口可以获取 WebGLRenderingContext 对象,实现了 [WebGL 1.0](https://www.khronos.org/registry/webgl/specs/latest/1.0/) 定义的所有属性、方法、常量。 + * - CanvasRenderingContext2D 的 drawImage 方法 2.10.0 起支持传入通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取的 video 对象 + * + * **示例代码** + * + * + * + * video 画到 2D Canvas 示例 + * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/tJTak7mU7sfX) */ interface RenderingContext {} interface RequestOption { /** 开发者服务器接口地址 */ @@ -4969,7 +5003,7 @@ innerAudioContext.onError((res) => { withShareTicket?: boolean } interface UploadFileOption { - /** 要上传文件资源的路径 (网络路径) */ + /** 要上传文件资源的路径 (本地路径) */ filePath: string /** 文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容 */ name: string @@ -5727,7 +5761,7 @@ listener.start() * 支持获取 2D 和 WebGL 绘图上下文 * * 最低基础库: `2.7.0` */ - getContext(contextType: string): RenderingContext + getContext(contextType: string): any /** [number Canvas.requestAnimationFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.requestAnimationFrame.html) * * 在下次进行重绘时执行。 支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。 @@ -6962,7 +6996,7 @@ ctx.draw() * - 'normal': ; */ textBaseline: 'top' | 'bottom' | 'middle' | 'normal', ): void - /** [CanvasContext.setTransform(number scaleX, number scaleY, number skewX, number skewY, number translateX, number translateY)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTransform.html) + /** [CanvasContext.setTransform(number scaleX, number skewX, number skewY, number scaleY, number translateX, number translateY)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTransform.html) * * 使用矩阵重新设置(覆盖)当前变换的方法 * @@ -6970,12 +7004,12 @@ ctx.draw() setTransform( /** 水平缩放 */ scaleX: number, - /** 垂直缩放 */ - scaleY: number, /** 水平倾斜 */ skewX: number, /** 垂直倾斜 */ skewY: number, + /** 垂直缩放 */ + scaleY: number, /** 水平移动 */ translateX: number, /** 垂直移动 */ @@ -7064,7 +7098,7 @@ ctx.draw() /** 需要绘制的最大宽度,可选 */ maxWidth?: number, ): void - /** [CanvasContext.transform(number scaleX, number scaleY, number skewX, number skewY, number translateX, number translateY)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.transform.html) + /** [CanvasContext.transform(number scaleX, number skewX, number skewY, number scaleY, number translateX, number translateY)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.transform.html) * * 使用矩阵多次叠加当前变换的方法 * @@ -7072,12 +7106,12 @@ ctx.draw() transform( /** 水平缩放 */ scaleX: number, - /** 垂直缩放 */ - scaleY: number, /** 水平倾斜 */ skewX: number, /** 垂直倾斜 */ skewY: number, + /** 垂直缩放 */ + scaleY: number, /** 水平移动 */ translateX: number, /** 垂直移动 */ @@ -7325,7 +7359,9 @@ ctx.draw() blur(option?: BlurOption): void /** [EditorContext.clear(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.clear.html) * - * 清空编辑器内容 */ + * 清空编辑器内容 + * + * 最低基础库: `2.7.0` */ clear(option?: ClearOption): void /** [EditorContext.format(string name, string value)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.format.html) * @@ -7334,30 +7370,35 @@ ctx.draw() * **** * * ## 支持设置的样式列表 - * | name | value | - * | ------| ------ | - * | bold | | - * | italic | | - * | underline | | - * | strike | | - * | ins | | - * | script | sub / super | - * | header | H1 / H2 / h3 / H4 / h5 / H6 | - * | align | left / center / right / justify | - * | direction | rtl | - * | indent | -1 / +1 | - * | list | ordered / bullet / check | - * | color | hex color | - * | backgroundColor| hex color | - * | margin/marginTop/marginBottom/marginLeft/marginRight | css style | - * | padding/paddingTop/paddingBottom/paddingLeft/paddingRight | css style | - * | font/fontSize/fontStyle/fontVariant/fontWeight/fontFamily | css style | - * | lineHeight | css style | - * | letterSpacing | css style | - * | textDecoration | css style | - * | textIndent | css style | - * - * 对已经应用样式的选区设置会取消样式。css style 表示 css 中规定的允许值。 */ + * | name | value | verson | + * | --------------------------------------------------------- | ------------------------------- | ------ | + * | bold | | 2.7.0 | + * | italic | | 2.7.0 | + * | underline | | 2.7.0 | + * | strike | | 2.7.0 | + * | ins | | 2.7.0 | + * | script | sub / super | 2.7.0 | + * | header | H1 / H2 / h3 / H4 / h5 / H6 | 2.7.0 | + * | align | left / center / right / justify | 2.7.0 | + * | direction | rtl | 2.7.0 | + * | indent | -1 / +1 | 2.7.0 | + * | list | ordered / bullet / check | 2.7.0 | + * | color | hex color | 2.7.0 | + * | backgroundColor | hex color | 2.7.0 | + * | margin/marginTop/marginBottom/marginLeft/marginRight | css style | 2.7.0 | + * | padding/paddingTop/paddingBottom/paddingLeft/paddingRight | css style | 2.7.0 | + * | font/fontSize/fontStyle/fontVariant/fontWeight/fontFamily | css style | 2.7.0 | + * | lineHeight | css style | 2.7.0 | + * | letterSpacing | css style | 2.7.0 | + * | textDecoration | css style | 2.7.0 | + * | textIndent | css style | 2.8.0 | + * | wordWrap | css style | 2.10.2 | + * | wordBreak | css style | 2.10.2 | + * | whiteSpace | css style | 2.10.2 | + * + * 对已经应用样式的选区设置会取消样式。css style 表示 css 中规定的允许值。 + * + * 最低基础库: `2.7.0` */ format( /** 属性 */ name: string, @@ -7366,11 +7407,21 @@ ctx.draw() ): void /** [EditorContext.getContents(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getContents.html) * - * 获取编辑器内容 */ + * 获取编辑器内容 + * + * 最低基础库: `2.7.0` */ getContents(option?: GetContentsOption): void + /** [EditorContext.getSelectionText(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getSelectionText.html) + * + * 获取编辑器已选区域内的纯文本内容。当编辑器失焦或未选中一段区间时,返回内容为空。 + * + * 最低基础库: `2.10.2` */ + getSelectionText(option?: GetSelectionTextOption): void /** [EditorContext.insertDivider(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertDivider.html) * - * 插入分割线 */ + * 插入分割线 + * + * 最低基础库: `2.7.0` */ insertDivider(option?: InsertDividerOption): void /** [EditorContext.insertImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertImage.html) * @@ -7390,19 +7441,27 @@ this.editorCtx.insertImage({ height: '50px', extClass: className }) -``` */ +``` +* +* 最低基础库: `2.7.0` */ insertImage(option: InsertImageOption): void /** [EditorContext.insertText(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertText.html) * - * 覆盖当前选区,设置一段文本 */ + * 覆盖当前选区,设置一段文本 + * + * 最低基础库: `2.7.0` */ insertText(option: InsertTextOption): void /** [EditorContext.redo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.redo.html) * - * 恢复 */ + * 恢复 + * + * 最低基础库: `2.7.0` */ redo(option?: RedoOption): void /** [EditorContext.removeFormat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.removeFormat.html) * - * 清除当前选区的样式 */ + * 清除当前选区的样式 + * + * 最低基础库: `2.7.0` */ removeFormat(option?: RemoveFormatOption): void /** [EditorContext.scrollIntoView()](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.scrollIntoView.html) * @@ -7412,11 +7471,15 @@ this.editorCtx.insertImage({ scrollIntoView(): void /** [EditorContext.setContents(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.setContents.html) * - * 初始化编辑器内容,html和delta同时存在时仅delta生效 */ + * 初始化编辑器内容,html和delta同时存在时仅delta生效 + * + * 最低基础库: `2.7.0` */ setContents(option: SetContentsOption): void /** [EditorContext.undo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.undo.html) * - * 撤销 */ + * 撤销 + * + * 最低基础库: `2.7.0` */ undo(option?: UndoOption): void } interface EventChannel { @@ -7676,7 +7739,7 @@ this.editorCtx.insertImage({ * 最低基础库: `2.3.0` */ recursive?: boolean, ): Stats | IAnyObject - /** [number FileSystemManager.saveFileSync(string tempFilePath, string filePath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFileSync.html) + /** [string FileSystemManager.saveFileSync(string tempFilePath, string filePath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFileSync.html) * * [FileSystemManager.saveFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFile.html) 的同步版本 */ saveFileSync( @@ -7684,7 +7747,7 @@ this.editorCtx.insertImage({ tempFilePath: string, /** 要存储的文件路径 (本地路径) */ filePath?: string, - ): number + ): string /** [string|ArrayBuffer FileSystemManager.readFileSync(string filePath, string encoding, string position, string length)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFileSync.html) * * [FileSystemManager.readFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html) 的同步版本 */ @@ -8531,7 +8594,7 @@ Page({ * 当前仅支持获取 WebGL 绘图上下文 * * 最低基础库: `2.7.0` */ - getContext(contextType: string): RenderingContext + getContext(contextType: string): any } interface RealtimeLogManager { /** [RealtimeLogManager.addFilterMsg(string msg)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.addFilterMsg.html) @@ -9206,7 +9269,7 @@ worker.postMessage({ ): ArrayBuffer /** [Object wx.getAccountInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/account-info/wx.getAccountInfoSync.html) * -* 获取当前帐号信息 +* 获取当前帐号信息。线上小程序版本号仅支持在正式版小程序中获取,开发版和体验版中无法获取。 * * **示例代码** * @@ -9280,6 +9343,7 @@ console.log(extConfig) * | 1037 | 小程序打开小程序 | 来源小程序 | * | 1038 | 从另一个小程序返回 | 来源小程序 | * | 1043 | 公众号模板消息 | 来源公众号 | + * | 1069 | 移动应用 | 来源App | * * **注意** * @@ -12459,7 +12523,7 @@ wx.requestSubscribeMessage({ }) ``` * -* 最低基础库: `2.8.2` */ +* 最低基础库: `2.4.4` */ requestSubscribeMessage(option: RequestSubscribeMessageOption): void /** [wx.saveFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.saveFile.html) * @@ -14118,7 +14182,9 @@ wx.writeBLECharacteristicValue({ /** 接口调用失败的回调函数 */ type GetContentsFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ - type GetContentsSuccessCallback = (res: GeneralCallbackResult) => void + type GetContentsSuccessCallback = ( + result: GetContentsSuccessCallbackResult, + ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetExtConfigCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ @@ -14210,6 +14276,14 @@ wx.writeBLECharacteristicValue({ result: GetSelectedTextRangeSuccessCallbackResult, ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type GetSelectionTextCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type GetSelectionTextFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type GetSelectionTextSuccessCallback = ( + result: GetSelectionTextSuccessCallbackResult, + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetSettingCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type GetSettingFailCallback = (res: GeneralCallbackResult) => void @@ -15778,10 +15852,6 @@ declare function require(module: string): any declare let module: { exports: any } declare let exports: any -/** [Promise createBLEPeripheralServer()](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/createBLEPeripheralServer.html) - * - * 建立本地作为外围设备的服务端,可创建多个 */ -declare function createBLEPeripheralServer(): Promise /** [clearInterval(number intervalID)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/clearInterval.html) * * 取消由 setInterval 设置的定时器。 */ From 94a01f947ed6e9567672ff955121b640af75d603 Mon Sep 17 00:00:00 2001 From: SgLy <775150558@qq.com> Date: Wed, 18 Mar 2020 20:40:35 +0800 Subject: [PATCH 006/205] feat(api): support api promisify in 2.10.2 This commit closes #105 --- CHANGELOG.md | 3 + VERSIONS.md | 2 +- package-lock.json | 2 +- package.json | 2 +- test/{api_doc.test.ts => api-doc.test.ts} | 0 test/api-promisify.test.ts | 210 +++++++ tsconfig.json | 2 +- types/wx/index.d.ts | 13 + types/wx/lib.wx.api.d.ts | 699 ++++++++++++++++------ 9 files changed, 738 insertions(+), 195 deletions(-) rename test/{api_doc.test.ts => api-doc.test.ts} (100%) create mode 100644 test/api-promisify.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 510bf35..db43995 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2020-03-18 v2.10.2-1 +- 支持 API Promise 化调用(#105) + ## 2020-03-06 v2.10.2 - 同步 API 定义到基础库 2.10.2 diff --git a/VERSIONS.md b/VERSIONS.md index 903d583..4d50f06 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -2,7 +2,7 @@ 基础库版本|npm 版本|命令 -|-|- -[v2.10.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-2-2020-02-20) | [2.10.2](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.2) | `npm install miniprogram-api-typings@2.10.2` +[v2.10.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-2-2020-02-20) | [2.10.2-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.2-1) | `npm install miniprogram-api-typings@2.10.2-1` [v2.10.1](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-1-2020-01-14) | [2.10.1-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.1-1) | `npm install miniprogram-api-typings@2.10.1-1` [v2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-0-2019-12-24) | [2.10.0-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.0-1) | `npm install miniprogram-api-typings@2.10.0-1` [v2.9.4](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-9-4-2019-11-28) | [2.9.4](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.4) | `npm install miniprogram-api-typings@2.9.4` diff --git a/package-lock.json b/package-lock.json index e9f929d..6268323 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.10.2", + "version": "2.10.2-1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a27e05f..d87082c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.10.2", + "version": "2.10.2-1", "description": "Type definitions for APIs of Wechat Mini Program in TypeScript", "main": "./index.d.ts", "types": "./index.d.ts", diff --git a/test/api_doc.test.ts b/test/api-doc.test.ts similarity index 100% rename from test/api_doc.test.ts rename to test/api-doc.test.ts diff --git a/test/api-promisify.test.ts b/test/api-promisify.test.ts new file mode 100644 index 0000000..d694df0 --- /dev/null +++ b/test/api-promisify.test.ts @@ -0,0 +1,210 @@ +import { expectType } from 'tsd' + +// call with callback +wx.chooseImage({ + success(res) { + expectType(res) + }, +}) +wx.canvasToTempFilePath({ + canvasId: '', + success(res) { + expectType( + res, + ) + }, +}) +wx.stopAccelerometer({ + fail(res) { + expectType(res) + }, +}) +wx.getClipboardData({ + success(res) { + expectType(res) + }, +}) +wx.stopCompass({ + complete(res) { + expectType(res) + }, +}) +wx.addPhoneContact({ + firstName: '', + complete(res) { + expectType(res) + }, +}) +wx.startLocalServiceDiscovery({ + serviceType: '', + success(res) { + expectType(res) + }, +}) +wx.getSystemInfo({ + success(res) { + expectType(res) + }, +}) +wx.chooseLocation({ + success(res) { + expectType(res) + }, +}) +wx.previewImage({ + urls: [], + success(res) { + expectType(res) + }, +}) +wx.saveVideoToPhotosAlbum({ + filePath: '', + success(res) { + expectType(res) + }, +}) +wx.removeSavedFile({ + filePath: '', + success(res) { + expectType(res) + }, +}) + +wx.createBLEConnection({ + deviceId: '', + success(res) { + expectType(res) + }, +}) + +wx.startBluetoothDevicesDiscovery({ + success(res) { + expectType(res) + }, +}) +wx.hideShareMenu({ + success(res) { + expectType(res) + }, +}) + +wx.checkIsSupportSoterAuthentication({ + success(res) { + expectType< + WechatMiniprogram.CheckIsSupportSoterAuthenticationSuccessCallbackResult + >(res) + }, +}) +wx.navigateBack({ + success(res) { + expectType(res) + }, +}) + +// call with Promise.prototype.then +wx.chooseImage({}).then(res => { + expectType(res) +}) +wx.canvasToTempFilePath({ + canvasId: '', +}).then(res => { + expectType(res) +}) +wx.stopAccelerometer().then(res => { + expectType(res) +}) +wx.getClipboardData().then(res => { + expectType(res) +}) +wx.stopCompass().then(res => { + expectType(res) +}) +wx.addPhoneContact({ + firstName: '', +}).then(res => { + expectType(res) +}) +wx.startLocalServiceDiscovery({ serviceType: '' }).then(res => { + expectType(res) +}) +wx.getSystemInfo().then(res => { + expectType(res) +}) +wx.chooseLocation({}).then(res => { + expectType(res) +}) +wx.previewImage({ urls: [] }).then(res => { + expectType(res) +}) +wx.saveVideoToPhotosAlbum({ filePath: '' }).then(res => { + expectType(res) +}) +wx.removeSavedFile({ filePath: '' }).then(res => { + expectType(res) +}) +wx.createBLEConnection({ deviceId: '' }).then(res => { + expectType(res) +}) +wx.startBluetoothDevicesDiscovery({}).then(res => { + expectType(res) +}) +wx.hideShareMenu().then(res => { + expectType(res) +}) +wx.checkIsSupportSoterAuthentication().then(res => { + expectType< + WechatMiniprogram.CheckIsSupportSoterAuthenticationSuccessCallbackResult + >(res) +}) +wx.navigateBack().then(res => { + expectType(res) +}) + +// call with await +async () => { + expectType( + await wx.chooseImage({}), + ) + expectType( + await wx.canvasToTempFilePath({ canvasId: '' }), + ) + expectType( + await wx.stopAccelerometer(), + ) + expectType( + await wx.getClipboardData(), + ) + expectType(await wx.stopCompass()) + expectType( + await wx.addPhoneContact({ firstName: '' }), + ) + expectType( + await wx.startLocalServiceDiscovery({ serviceType: '' }), + ) + expectType( + await wx.getSystemInfo(), + ) + expectType( + await wx.chooseLocation({}), + ) + expectType( + await wx.previewImage({ urls: [] }), + ) + expectType( + await wx.saveVideoToPhotosAlbum({ filePath: '' }), + ) + expectType( + await wx.removeSavedFile({ filePath: '' }), + ) + expectType( + await wx.createBLEConnection({ deviceId: '' }), + ) + expectType( + await wx.startBluetoothDevicesDiscovery({}), + ) + expectType(await wx.hideShareMenu()) + expectType< + WechatMiniprogram.CheckIsSupportSoterAuthenticationSuccessCallbackResult + >(await wx.checkIsSupportSoterAuthentication()) + expectType(await wx.navigateBack()) +} diff --git a/tsconfig.json b/tsconfig.json index 6479dfc..f96df03 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,7 @@ "experimentalDecorators": true, "inlineSourceMap": true, "inlineSources": true, - "lib": ["es5"], + "lib": ["es6"], "module": "CommonJS", "noFallthroughCasesInSwitch": true, "noImplicitAny": true, diff --git a/types/wx/index.d.ts b/types/wx/index.d.ts index f3f5f9a..52069b1 100644 --- a/types/wx/index.d.ts +++ b/types/wx/index.d.ts @@ -31,4 +31,17 @@ declare namespace WechatMiniprogram { type IAnyObject = Record type Optional = F extends (arg: infer P) => infer R ? (arg?: P) => R : F type OptionalInterface = { [K in keyof T]: Optional } + interface AsyncMethodOptionLike { + success?: (...args: any[]) => void + } + type PromisifySuccessResult< + P, + T extends AsyncMethodOptionLike + > = P extends { success: any } + ? void + : P extends { fail: any } + ? void + : P extends { complete: any } + ? void + : Promise>[0]> } diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index 0cfd67e..6bb6f18 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -4822,7 +4822,7 @@ innerAudioContext.onError((res) => { } /** 订阅消息设置 */ interface SubscriptionsSetting { - /** 每一项订阅消息的订阅状态。itemSettings对象的键为**一次性订阅消息的模板id**或**系统订阅消息的类型**,值为'accept'、'reject'、'ban'中的其中一种。'accept'表示用户同意订阅这条消息,'reject'表示用户拒绝订阅这条消息,'ban'表示已被后台封禁。一次性订阅消息使用方法详见 [wx.requestSubscribeMessage](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html),永久订阅消息(仅小游戏可用)使用方法详见[wx.requestSubscribeSystemMessage](#) */ + /** 每一项订阅消息的订阅状态。itemSettings对象的键为**一次性订阅消息的模板id**或**系统订阅消息的类型**,值为'accept'、'reject'、'ban'中的其中一种。'accept'表示用户同意订阅这条消息,'reject'表示用户拒绝订阅这条消息,'ban'表示已被后台封禁。一次性订阅消息使用方法详见 [wx.requestSubscribeMessage](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html),永久订阅消息(仅小游戏可用)使用方法详见[wx.requestSubscribeSystemMessage](/minigame/dev/api/open-api/subscribe-message/wx.requestSubscribeSystemMessage.html) */ itemSettings: IAnyObject /** 订阅消息总开关,true为开启,false为关闭 */ mainSwitch: boolean @@ -9844,13 +9844,17 @@ wx.addCard({ ``` * * 最低基础库: `1.1.0` */ - addCard(option: AddCardOption): void + addCard( + option: TOption, + ): PromisifySuccessResult /** [wx.addPhoneContact(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.addPhoneContact.html) * * 添加手机通讯录联系人。用户可以选择将该表单以「新增联系人」或「添加到已有联系人」的方式,写入手机系统通讯录。 * * 最低基础库: `1.2.0` */ - addPhoneContact(option: AddPhoneContactOption): void + addPhoneContact( + option: TOption, + ): PromisifySuccessResult /** [wx.authorize(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorize.html) * * 提前向用户发起授权请求。调用后会立刻弹窗询问用户是否同意授权小程序使用某项功能或获取用户的某些数据,但不会实际调用对应接口。如果用户之前已经同意授权,则不会出现弹窗,直接返回成功。更多用法详见 [用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)。 @@ -9876,7 +9880,9 @@ wx.getSetting({ ``` * * 最低基础库: `1.2.0` */ - authorize(option: AuthorizeOption): void + authorize( + option: TOption, + ): PromisifySuccessResult /** [wx.canvasGetImageData(Object object, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasGetImageData.html) * * 获取 canvas 区域隐含的像素数据。 @@ -9903,29 +9909,29 @@ wx.canvasGetImageData({ ``` * * 最低基础库: `1.9.0` */ - canvasGetImageData( - option: CanvasGetImageDataOption, + canvasGetImageData( + option: TOption, /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 */ component?: Component.TrivialInstance | Page.TrivialInstance, - ): void + ): PromisifySuccessResult /** [wx.canvasPutImageData(Object object, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasPutImageData.html) * * 将像素数据绘制到画布。在自定义组件下,第二个参数传入自定义组件实例 this,以操作组件内 组件 * * 最低基础库: `1.9.0` */ - canvasPutImageData( - option: CanvasPutImageDataOption, + canvasPutImageData( + option: TOption, /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 */ component?: Component.TrivialInstance | Page.TrivialInstance, - ): void + ): PromisifySuccessResult /** [wx.canvasToTempFilePath(Object object, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasToTempFilePath.html) * * 把当前画布指定区域的内容导出生成指定大小的图片。在 `draw()` 回调里调用该方法才能保证图片导出成功。 */ - canvasToTempFilePath( - option: CanvasToTempFilePathOption, + canvasToTempFilePath( + option: TOption, /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 */ component?: Component.TrivialInstance | Page.TrivialInstance, - ): void + ): PromisifySuccessResult /** [wx.checkIsSoterEnrolledInDevice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.checkIsSoterEnrolledInDevice.html) * * 获取设备内是否录入如指纹等生物信息的接口 @@ -9943,9 +9949,11 @@ wx.checkIsSoterEnrolledInDevice({ ``` * * 最低基础库: `1.6.0` */ - checkIsSoterEnrolledInDevice( - option: CheckIsSoterEnrolledInDeviceOption, - ): void + checkIsSoterEnrolledInDevice< + TOption extends CheckIsSoterEnrolledInDeviceOption + >( + option: TOption, + ): PromisifySuccessResult /** [wx.checkIsSupportSoterAuthentication(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.checkIsSupportSoterAuthentication.html) * * 获取本机支持的 SOTER 生物认证方式 @@ -9964,9 +9972,14 @@ wx.checkIsSupportSoterAuthentication({ ``` * * 最低基础库: `1.5.0` */ - checkIsSupportSoterAuthentication( - option?: CheckIsSupportSoterAuthenticationOption, - ): void + checkIsSupportSoterAuthentication< + TOption extends CheckIsSupportSoterAuthenticationOption + >( + option?: TOption, + ): PromisifySuccessResult< + TOption, + CheckIsSupportSoterAuthenticationOption + > /** [wx.checkSession(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.checkSession.html) * * 检查登录态是否过期。 @@ -9989,7 +10002,9 @@ wx.checkSession({ } }) ``` */ - checkSession(option?: CheckSessionOption): void + checkSession( + option?: TOption, + ): PromisifySuccessResult /** [wx.chooseAddress(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/address/wx.chooseAddress.html) * * 获取用户收货地址。调起用户编辑收货地址原生界面,并在编辑完成后返回用户选择的地址。 @@ -10014,7 +10029,9 @@ wx.chooseAddress({ ``` * * 最低基础库: `1.1.0` */ - chooseAddress(option?: ChooseAddressOption): void + chooseAddress( + option?: TOption, + ): PromisifySuccessResult /** [wx.chooseImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html) * * 从本地相册选择图片或使用相机拍照。 @@ -10032,7 +10049,9 @@ wx.chooseImage({ } }) ``` */ - chooseImage(option: ChooseImageOption): void + chooseImage( + option: TOption, + ): PromisifySuccessResult /** [wx.chooseInvoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoice.html) * * 选择用户已有的发票。 @@ -10044,7 +10063,9 @@ wx.chooseImage({ * 其中 `access_token` 的获取请参考[auth.getAccessToken](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html)文档 * * 最低基础库: `2.3.0` */ - chooseInvoice(option?: ChooseInvoiceOption): void + chooseInvoice( + option?: TOption, + ): PromisifySuccessResult /** [wx.chooseInvoiceTitle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoiceTitle.html) * * 选择用户的发票抬头。当前小程序必须关联一个公众号,且这个公众号是完成了[微信认证](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1496554031_RD4xe)的,才能调用 chooseInvoiceTitle。 @@ -10061,11 +10082,15 @@ wx.chooseInvoiceTitle({ ``` * * 最低基础库: `1.5.0` */ - chooseInvoiceTitle(option?: ChooseInvoiceTitleOption): void + chooseInvoiceTitle( + option?: TOption, + ): PromisifySuccessResult /** [wx.chooseLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.chooseLocation.html) * * 打开地图选择位置。 */ - chooseLocation(option: ChooseLocationOption): void + chooseLocation( + option: TOption, + ): PromisifySuccessResult /** [wx.chooseMedia(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html) * * 拍摄或从手机相册中选择图片或视频。 @@ -10088,7 +10113,9 @@ wx.chooseMedia({ ``` * * 最低基础库: `2.10.0` */ - chooseMedia(option: ChooseMediaOption): void + chooseMedia( + option: TOption, + ): PromisifySuccessResult /** [wx.chooseMessageFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseMessageFile.html) * * 从客户端会话选择文件。 @@ -10101,13 +10128,15 @@ wx.chooseMessageFile({ type: 'image', success (res) { // tempFilePath可以作为img标签的src属性显示图片 - const tempFilePaths = res.tempFilePaths + const tempFilePaths = res.tempFiles } }) ``` * * 最低基础库: `2.5.0` */ - chooseMessageFile(option: ChooseMessageFileOption): void + chooseMessageFile( + option: TOption, + ): PromisifySuccessResult /** [wx.chooseVideo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseVideo.html) * * 拍摄视频或从手机相册中选视频。 @@ -10125,7 +10154,9 @@ wx.chooseVideo({ } }) ``` */ - chooseVideo(option: ChooseVideoOption): void + chooseVideo( + option: TOption, + ): PromisifySuccessResult /** [wx.clearStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorage.html) * * 清理本地数据缓存 @@ -10144,7 +10175,9 @@ try { // Do something when catch error } ``` */ - clearStorage(option?: ClearStorageOption): void + clearStorage( + option?: TOption, + ): PromisifySuccessResult /** [wx.clearStorageSync()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorageSync.html) * * [wx.clearStorage](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorage.html) 的同步版本 @@ -10182,7 +10215,9 @@ wx.closeBLEConnection({ ``` * * 最低基础库: `1.1.0` */ - closeBLEConnection(option: CloseBLEConnectionOption): void + closeBLEConnection( + option: TOption, + ): PromisifySuccessResult /** [wx.closeBluetoothAdapter(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.closeBluetoothAdapter.html) * * 关闭蓝牙模块。调用该方法将断开所有已建立的连接并释放系统资源。建议在使用蓝牙流程后,与 [wx.openBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html) 成对调用。 @@ -10200,7 +10235,9 @@ wx.closeBluetoothAdapter({ ``` * * 最低基础库: `1.1.0` */ - closeBluetoothAdapter(option?: CloseBluetoothAdapterOption): void + closeBluetoothAdapter( + option?: TOption, + ): PromisifySuccessResult /** [wx.closeSocket(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.closeSocket.html) * * 关闭 WebSocket 连接 @@ -10224,7 +10261,9 @@ wx.onSocketClose(function(res) { console.log('WebSocket 已关闭!') }) ``` */ - closeSocket(option?: CloseSocketOption): void + closeSocket( + option?: TOption, + ): PromisifySuccessResult /** [wx.compressImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.compressImage.html) * * 压缩图片接口,可选压缩质量 @@ -10240,7 +10279,9 @@ wx.compressImage({ ``` * * 最低基础库: `2.4.0` */ - compressImage(option: CompressImageOption): void + compressImage( + option: TOption, + ): PromisifySuccessResult /** [wx.connectWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.connectWifi.html) * * 连接 Wi-Fi。若已知 Wi-Fi 信息,可以直接利用该接口连接。仅 Android 与 iOS 11 以上版本支持。 @@ -10259,7 +10300,9 @@ wx.connectWifi({ ``` * * 最低基础库: `1.6.0` */ - connectWifi(option: ConnectWifiOption): void + connectWifi( + option: TOption, + ): PromisifySuccessResult /** [wx.createBLEConnection(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) * * 连接低功耗蓝牙设备。 @@ -10288,13 +10331,19 @@ wx.createBLEConnection({ ``` * * 最低基础库: `1.1.0` */ - createBLEConnection(option: CreateBLEConnectionOption): void + createBLEConnection( + option: TOption, + ): PromisifySuccessResult /** [wx.getAvailableAudioSources(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.getAvailableAudioSources.html) * * 获取当前支持的音频输入源 * * 最低基础库: `2.1.0` */ - getAvailableAudioSources(option?: GetAvailableAudioSourcesOption): void + getAvailableAudioSources< + TOption extends GetAvailableAudioSourcesOption + >( + option?: TOption, + ): PromisifySuccessResult /** [wx.getBLEDeviceCharacteristics(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceCharacteristics.html) * * 获取蓝牙设备某个服务中所有特征值(characteristic)。 @@ -10316,9 +10365,11 @@ wx.getBLEDeviceCharacteristics({ ``` * * 最低基础库: `1.1.0` */ - getBLEDeviceCharacteristics( - option: GetBLEDeviceCharacteristicsOption, - ): void + getBLEDeviceCharacteristics< + TOption extends GetBLEDeviceCharacteristicsOption + >( + option: TOption, + ): PromisifySuccessResult /** [wx.getBLEDeviceServices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceServices.html) * * 获取蓝牙设备所有服务(service)。 @@ -10338,7 +10389,9 @@ wx.getBLEDeviceServices({ ``` * * 最低基础库: `1.1.0` */ - getBLEDeviceServices(option: GetBLEDeviceServicesOption): void + getBLEDeviceServices( + option: TOption, + ): PromisifySuccessResult /** [wx.getBackgroundAudioPlayerState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioPlayerState.html) * * 获取后台音乐播放状态。 @@ -10357,31 +10410,41 @@ wx.getBackgroundAudioPlayerState({ } }) ``` */ - getBackgroundAudioPlayerState( - option?: GetBackgroundAudioPlayerStateOption, - ): void + getBackgroundAudioPlayerState< + TOption extends GetBackgroundAudioPlayerStateOption + >( + option?: TOption, + ): PromisifySuccessResult /** [wx.getBackgroundFetchData(object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchData.html) * * 拉取 backgroundFetch 客户端缓存数据 * * 最低基础库: `2.8.0` */ - getBackgroundFetchData(option: GetBackgroundFetchDataOption): void + getBackgroundFetchData( + option: TOption, + ): PromisifySuccessResult /** [wx.getBackgroundFetchToken(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchToken.html) * * 获取设置过的自定义登录态。若无,则返回 fail。 * * 最低基础库: `2.8.0` */ - getBackgroundFetchToken(option?: GetBackgroundFetchTokenOption): void + getBackgroundFetchToken( + option?: TOption, + ): PromisifySuccessResult /** [wx.getBatteryInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfo.html) * * 获取设备电量。同步 API [wx.getBatteryInfoSync](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfoSync.html) 在 iOS 上不可用。 */ - getBatteryInfo(option?: GetBatteryInfoOption): void + getBatteryInfo( + option?: TOption, + ): PromisifySuccessResult /** [wx.getBeacons(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.getBeacons.html) * * 获取所有已搜索到的 iBeacon 设备 * * 最低基础库: `1.2.0` */ - getBeacons(option?: GetBeaconsOption): void + getBeacons( + option?: TOption, + ): PromisifySuccessResult /** [wx.getBluetoothAdapterState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getBluetoothAdapterState.html) * * 获取本机蓝牙适配器状态。 @@ -10399,7 +10462,11 @@ wx.getBluetoothAdapterState({ ``` * * 最低基础库: `1.1.0` */ - getBluetoothAdapterState(option?: GetBluetoothAdapterStateOption): void + getBluetoothAdapterState< + TOption extends GetBluetoothAdapterStateOption + >( + option?: TOption, + ): PromisifySuccessResult /** [wx.getBluetoothDevices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getBluetoothDevices.html) * * 获取在蓝牙模块生效期间所有已发现的蓝牙设备。包括已经和本机处于连接状态的设备。 @@ -10437,7 +10504,9 @@ wx.getBluetoothDevices({ * - 蓝牙设备在被搜索到时,系统返回的 name 字段一般为广播包中的 LocalName 字段中的设备名称,而如果与蓝牙设备建立连接,系统返回的 name 字段会改为从蓝牙设备上获取到的 `GattName`。若需要动态改变设备名称并展示,建议使用 `localName` 字段。 * * 最低基础库: `1.1.0` */ - getBluetoothDevices(option?: GetBluetoothDevicesOption): void + getBluetoothDevices( + option?: TOption, + ): PromisifySuccessResult /** [wx.getClipboardData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.getClipboardData.html) * * 获取系统剪贴板的内容 @@ -10454,7 +10523,9 @@ wx.getClipboardData({ ``` * * 最低基础库: `1.1.0` */ - getClipboardData(option?: GetClipboardDataOption): void + getClipboardData( + option?: TOption, + ): PromisifySuccessResult /** [wx.getConnectedBluetoothDevices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getConnectedBluetoothDevices.html) * * 根据 uuid 获取处于已连接状态的设备。 @@ -10472,15 +10543,19 @@ wx.getConnectedBluetoothDevices({ ``` * * 最低基础库: `1.1.0` */ - getConnectedBluetoothDevices( - option: GetConnectedBluetoothDevicesOption, - ): void + getConnectedBluetoothDevices< + TOption extends GetConnectedBluetoothDevicesOption + >( + option: TOption, + ): PromisifySuccessResult /** [wx.getConnectedWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.getConnectedWifi.html) * * 获取已连接中的 Wi-Fi 信息。 * * 最低基础库: `1.6.0` */ - getConnectedWifi(option?: GetConnectedWifiOption): void + getConnectedWifi( + option?: TOption, + ): PromisifySuccessResult /** [wx.getExtConfig(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfig.html) * * 获取[第三方平台](https://developers.weixin.qq.com/miniprogram/dev/devtools/ext.html)自定义的数据字段。 @@ -10503,7 +10578,9 @@ if (wx.getExtConfig) { ``` * * 最低基础库: `1.1.0` */ - getExtConfig(option?: GetExtConfigOption): void + getExtConfig( + option?: TOption, + ): PromisifySuccessResult /** [wx.getFileInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileInfo.html) * * 获取文件信息 @@ -10521,7 +10598,9 @@ wx.getFileInfo({ ``` * * 最低基础库: `1.4.0` */ - getFileInfo(option: WxGetFileInfoOption): void + getFileInfo( + option: TOption, + ): PromisifySuccessResult /** [wx.getHCEState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.getHCEState.html) * * 判断当前设备是否支持 HCE 能力。 @@ -10538,7 +10617,9 @@ wx.getHCEState({ ``` * * 最低基础库: `1.7.0` */ - getHCEState(option?: GetHCEStateOption): void + getHCEState( + option?: TOption, + ): PromisifySuccessResult /** [wx.getImageInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.getImageInfo.html) * * 获取图片信息。网络图片需先配置download域名才能生效。 @@ -10569,7 +10650,9 @@ wx.chooseImage({ } }) ``` */ - getImageInfo(option: GetImageInfoOption): void + getImageInfo( + option: TOption, + ): PromisifySuccessResult /** [wx.getLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html) * * 获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用。开启高精度定位,接口耗时会增加,可指定 highAccuracyExpireTime 作为超时时间。 @@ -10594,7 +10677,9 @@ wx.chooseImage({ * * - 工具中定位模拟使用IP定位,可能会有一定误差。且工具目前仅支持 gcj02 坐标。 * - 使用第三方服务进行逆地址解析时,请确认第三方服务默认的坐标系,正确进行坐标转换。 */ - getLocation(option: GetLocationOption): void + getLocation( + option: TOption, + ): PromisifySuccessResult /** [wx.getNetworkType(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.getNetworkType.html) * * 获取网络类型 @@ -10609,7 +10694,9 @@ wx.getNetworkType({ } }) ``` */ - getNetworkType(option?: GetNetworkTypeOption): void + getNetworkType( + option?: TOption, + ): PromisifySuccessResult /** [wx.getSavedFileInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getSavedFileInfo.html) * * 获取本地文件的文件信息。此接口只能用于获取已保存到本地的文件,若需要获取临时文件信息,请使用 [wx.getFileInfo()](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileInfo.html) 接口。 @@ -10624,7 +10711,9 @@ wx.getSavedFileList({ } }) ``` */ - getSavedFileInfo(option: GetSavedFileInfoOption): void + getSavedFileInfo( + option: TOption, + ): PromisifySuccessResult /** [wx.getSavedFileList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getSavedFileList.html) * * 获取该小程序下已保存的本地缓存文件列表 @@ -10639,7 +10728,9 @@ wx.getSavedFileList({ } }) ``` */ - getSavedFileList(option?: WxGetSavedFileListOption): void + getSavedFileList( + option?: TOption, + ): PromisifySuccessResult /** [wx.getScreenBrightness(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenBrightness.html) * * 获取屏幕亮度 @@ -10650,7 +10741,9 @@ wx.getSavedFileList({ * - 若安卓系统设置中开启了自动调节亮度功能,则屏幕亮度会根据光线自动调整,该接口仅能获取自动调节亮度之前的值,而非实时的亮度值。 * * 最低基础库: `1.2.0` */ - getScreenBrightness(option?: GetScreenBrightnessOption): void + getScreenBrightness( + option?: TOption, + ): PromisifySuccessResult /** [wx.getSelectedTextRange(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/keyboard/wx.getSelectedTextRange.html) * * 在input、textarea等focus之后,获取输入框的光标位置。注意:只有在focus的时候调用此接口才有效。 @@ -10667,7 +10760,9 @@ wx.getSelectedTextRange({ ``` * * 最低基础库: `2.7.0` */ - getSelectedTextRange(option?: GetSelectedTextRangeOption): void + getSelectedTextRange( + option?: TOption, + ): PromisifySuccessResult /** [wx.getSetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.getSetting.html) * * 获取用户的当前设置。**返回值中只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。 @@ -10711,7 +10806,9 @@ wx.getSetting({ ``` * * 最低基础库: `1.2.0` */ - getSetting(option: GetSettingOption): void + getSetting( + option: TOption, + ): PromisifySuccessResult /** [wx.getShareInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.getShareInfo.html) * * 获取转发详细信息 @@ -10762,7 +10859,9 @@ try { // Do something when catch error } ``` */ - getStorage(option: GetStorageOption): void + getStorage( + option: TOption, + ): PromisifySuccessResult /** [wx.getStorageInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfo.html) * * 异步获取当前storage的相关信息 @@ -10790,7 +10889,9 @@ try { // Do something when catch error } ``` */ - getStorageInfo(option?: GetStorageInfoOption): void + getStorageInfo( + option?: TOption, + ): PromisifySuccessResult /** [wx.getSystemInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfo.html) * * 获取系统信息 @@ -10826,7 +10927,9 @@ try { // Do something when catch error } ``` */ - getSystemInfo(option?: GetSystemInfoOption): void + getSystemInfo( + option?: TOption, + ): PromisifySuccessResult /** [wx.getUserInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html) * * 获取用户信息。 @@ -10969,13 +11072,17 @@ wx.getWeRunData({ * iOS 将跳转到系统的 Wi-Fi 界面,Android 不会跳转。 iOS 11.0 及 iOS 11.1 两个版本因系统问题,该方法失效。但在 iOS 11.2 中已修复。 * * 最低基础库: `1.6.0` */ - getWifiList(option?: GetWifiListOption): void + getWifiList( + option?: TOption, + ): PromisifySuccessResult /** [wx.hideHomeButton(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideHomeButton.html) * * 隐藏返回首页按钮。微信7.0.7版本起,当用户打开的小程序最底层页面是非首页时,默认展示“返回首页”按钮,开发者可在页面 onShow 中调用 hideHomeButton 进行隐藏。 * * 最低基础库: `2.8.3` */ - hideHomeButton(option?: HideHomeButtonOption): void + hideHomeButton( + option?: TOption, + ): PromisifySuccessResult /** [wx.hideKeyboard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/keyboard/wx.hideKeyboard.html) * * 在input、textarea等focus拉起键盘之后,手动调用此接口收起键盘 @@ -10992,17 +11099,25 @@ wx.hideKeyboard({ ``` * * 最低基础库: `2.8.2` */ - hideKeyboard(option?: HideKeyboardOption): void + hideKeyboard( + option?: TOption, + ): PromisifySuccessResult /** [wx.hideLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideLoading.html) * * 隐藏 loading 提示框 * * 最低基础库: `1.1.0` */ - hideLoading(option?: HideLoadingOption): void + hideLoading( + option?: TOption, + ): PromisifySuccessResult /** [wx.hideNavigationBarLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideNavigationBarLoading.html) * * 在当前页面隐藏导航条加载动画 */ - hideNavigationBarLoading(option?: HideNavigationBarLoadingOption): void + hideNavigationBarLoading< + TOption extends HideNavigationBarLoadingOption + >( + option?: TOption, + ): PromisifySuccessResult /** [wx.hideShareMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.hideShareMenu.html) * * 隐藏转发按钮 @@ -11015,23 +11130,31 @@ wx.hideShareMenu() ``` * * 最低基础库: `1.1.0` */ - hideShareMenu(option?: HideShareMenuOption): void + hideShareMenu( + option?: TOption, + ): PromisifySuccessResult /** [wx.hideTabBar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBar.html) * * 隐藏 tabBar * * 最低基础库: `1.9.0` */ - hideTabBar(option: HideTabBarOption): void + hideTabBar( + option: TOption, + ): PromisifySuccessResult /** [wx.hideTabBarRedDot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBarRedDot.html) * * 隐藏 tabBar 某一项的右上角的红点 * * 最低基础库: `1.9.0` */ - hideTabBarRedDot(option: HideTabBarRedDotOption): void + hideTabBarRedDot( + option: TOption, + ): PromisifySuccessResult /** [wx.hideToast(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideToast.html) * * 隐藏消息提示框 */ - hideToast(option?: HideToastOption): void + hideToast( + option?: TOption, + ): PromisifySuccessResult /** [wx.loadFontFace(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/font/wx.loadFontFace.html) * * 动态加载网络字体,文件地址需为下载类型。[2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)起支持全局生效,需在 `app.js` 中调用。 @@ -11057,7 +11180,9 @@ wx.loadFontFace({ ``` * * 最低基础库: `2.1.0` */ - loadFontFace(option: LoadFontFaceOption): void + loadFontFace( + option: TOption, + ): PromisifySuccessResult /** [wx.login(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html) * * 调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户的唯一标识(openid)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。 @@ -11095,11 +11220,15 @@ wx.makePhoneCall({ phoneNumber: '1340000' //仅为示例,并非真实的电话号码 }) ``` */ - makePhoneCall(option: MakePhoneCallOption): void + makePhoneCall( + option: TOption, + ): PromisifySuccessResult /** [wx.navigateBack(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html) * * 关闭当前页面,返回上一页面或多级页面。可通过 [getCurrentPages](https://developers.weixin.qq.com/miniprogram/dev/reference/api/getCurrentPages.html) 获取当前的页面栈,决定需要返回几层。 */ - navigateBack(option?: NavigateBackOption): void + navigateBack( + option?: TOption, + ): PromisifySuccessResult /** [wx.navigateBackMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/miniprogram-navigate/wx.navigateBackMiniProgram.html) * * 返回到上一个小程序。只有在当前小程序是被其他小程序打开时可以调用成功 @@ -11121,7 +11250,9 @@ success(res) { ``` * * 最低基础库: `1.3.0` */ - navigateBackMiniProgram(option: NavigateBackMiniProgramOption): void + navigateBackMiniProgram( + option: TOption, + ): PromisifySuccessResult /** [wx.navigateTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateTo.html) * * 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 [wx.navigateBack](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html) 可以返回到原页面。小程序中页面栈最多十层。 @@ -11165,7 +11296,9 @@ Page({ } }) ``` */ - navigateTo(option: NavigateToOption): void + navigateTo( + option: TOption, + ): PromisifySuccessResult /** [wx.navigateToMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/miniprogram-navigate/wx.navigateToMiniProgram.html) * * 打开另一个小程序 @@ -11204,7 +11337,9 @@ wx.navigateToMiniProgram({ ``` * * 最低基础库: `1.3.0` */ - navigateToMiniProgram(option: NavigateToMiniProgramOption): void + navigateToMiniProgram( + option: TOption, + ): PromisifySuccessResult /** [wx.nextTick(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/custom-component/wx.nextTick.html) * * 延迟一部分操作到下一个时间片再执行。(类似于 setTimeout) @@ -11268,9 +11403,14 @@ wx.notifyBLECharacteristicValueChange({ ``` * * 最低基础库: `1.1.0` */ - notifyBLECharacteristicValueChange( - option: NotifyBLECharacteristicValueChangeOption, - ): void + notifyBLECharacteristicValueChange< + TOption extends NotifyBLECharacteristicValueChangeOption + >( + option: TOption, + ): PromisifySuccessResult< + TOption, + NotifyBLECharacteristicValueChangeOption + > /** [wx.offAccelerometerChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.offAccelerometerChange.html) * * 取消监听加速度数据事件,参数为空,则取消所有的事件监听。 @@ -11685,7 +11825,9 @@ wx.onBLEConnectionStateChange(function(res) { * 收到 backgroundFetch 数据时的回调 * * 最低基础库: `2.8.0` */ - onBackgroundFetchData(option?: OnBackgroundFetchDataOption): void + onBackgroundFetchData( + option?: TOption, + ): PromisifySuccessResult /** [wx.onBeaconServiceChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconServiceChange.html) * * 监听 iBeacon 服务状态变化事件,仅能注册一个监听 @@ -12074,7 +12216,9 @@ wx.openBluetoothAdapter({ ``` * * 最低基础库: `1.1.0` */ - openBluetoothAdapter(option?: OpenBluetoothAdapterOption): void + openBluetoothAdapter( + option?: TOption, + ): PromisifySuccessResult /** [wx.openCard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/card/wx.openCard.html) * * 查看微信卡包中的卡券。只有通过 [认证](https://developers.weixin.qq.com/miniprogram/product/renzheng.html) 的小程序或文化互动类目的小游戏才能使用。更多文档请参考 [微信卡券接口文档](https://mp.weixin.qq.com/cgi-bin/announce?action=getannouncement&key=1490190158&version=1&lang=zh_CN&platform=2)。 @@ -12096,11 +12240,15 @@ wx.openCard({ ``` * * 最低基础库: `1.1.0` */ - openCard(option: OpenCardOption): void + openCard( + option: TOption, + ): PromisifySuccessResult /** [wx.openDocument(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.openDocument.html) * * 新开页面打开文档 */ - openDocument(option: OpenDocumentOption): void + openDocument( + option: TOption, + ): PromisifySuccessResult /** [wx.openLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.openLocation.html) * * 使用微信内置地图查看位置 @@ -12122,7 +12270,9 @@ wx.openCard({ } }) ``` */ - openLocation(option: OpenLocationOption): void + openLocation( + option: TOption, + ): PromisifySuccessResult /** [wx.openSetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.openSetting.html) * * 调起客户端小程序设置界面,返回用户设置的操作结果。**设置界面只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。 @@ -12146,7 +12296,9 @@ wx.openSetting({ ``` * * 最低基础库: `1.1.0` */ - openSetting(option?: OpenSettingOption): void + openSetting( + option?: TOption, + ): PromisifySuccessResult /** [wx.pageScrollTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/wx.pageScrollTo.html) * * 将页面滚动到目标位置,支持选择器和滚动距离两种方式定位 @@ -12174,7 +12326,9 @@ wx.pageScrollTo({ ``` * * 最低基础库: `1.4.0` */ - pageScrollTo(option: PageScrollToOption): void + pageScrollTo( + option: TOption, + ): PromisifySuccessResult /** [wx.pauseBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.pauseBackgroundAudio.html) * * 暂停播放音乐。 @@ -12185,7 +12339,9 @@ wx.pageScrollTo({ * ```js wx.pauseBackgroundAudio() ``` */ - pauseBackgroundAudio(option?: PauseBackgroundAudioOption): void + pauseBackgroundAudio( + option?: TOption, + ): PromisifySuccessResult /** [wx.pauseVoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.pauseVoice.html) * * 暂停正在播放的语音。再次调用 [wx.playVoice](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.playVoice.html) 播放同一个文件时,会从暂停处开始播放。如果想从头开始播放,需要先调用 [wx.stopVoice](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.stopVoice.html)。 @@ -12205,7 +12361,9 @@ wx.startRecord({ } }) ``` */ - pauseVoice(option?: PauseVoiceOption): void + pauseVoice( + option?: TOption, + ): PromisifySuccessResult /** [wx.playBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.playBackgroundAudio.html) * * 使用后台播放器播放音乐。对于微信客户端来说,只能同时有一个后台音乐在播放。当用户离开小程序后,音乐将暂停播放;当用户在其他小程序占用了音乐播放器,原有小程序内的音乐将停止播放。 @@ -12220,7 +12378,9 @@ wx.playBackgroundAudio({ coverImgUrl: '' }) ``` */ - playBackgroundAudio(option: PlayBackgroundAudioOption): void + playBackgroundAudio( + option: TOption, + ): PromisifySuccessResult /** [wx.playVoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.playVoice.html) * * 开始播放语音。同时只允许一个语音文件正在播放,如果前一个语音文件还没播放完,将中断前一个语音播放。 @@ -12239,7 +12399,9 @@ wx.startRecord({ } }) ``` */ - playVoice(option: PlayVoiceOption): void + playVoice( + option: TOption, + ): PromisifySuccessResult /** [wx.previewImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewImage.html) * * 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。 @@ -12253,7 +12415,9 @@ wx.previewImage({ urls: [] // 需要预览的图片http链接列表 }) ``` */ - previewImage(option: PreviewImageOption): void + previewImage( + option: TOption, + ): PromisifySuccessResult /** [wx.reLaunch(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.reLaunch.html) * * 关闭所有页面,打开到应用内的某个页面 @@ -12277,7 +12441,9 @@ wx.reLaunch({ * ``` * * 最低基础库: `1.1.0` */ - reLaunch(option: ReLaunchOption): void + reLaunch( + option: TOption, + ): PromisifySuccessResult /** [wx.readBLECharacteristicValue(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.readBLECharacteristicValue.html) * * 读取低功耗蓝牙设备的特征值的二进制数据值。注意:必须设备的特征值支持 read 才可以成功调用。 @@ -12312,9 +12478,11 @@ wx.readBLECharacteristicValue({ ``` * * 最低基础库: `1.1.0` */ - readBLECharacteristicValue( - option: ReadBLECharacteristicValueOption, - ): void + readBLECharacteristicValue< + TOption extends ReadBLECharacteristicValueOption + >( + option: TOption, + ): PromisifySuccessResult /** [wx.redirectTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.redirectTo.html) * * 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 @@ -12327,7 +12495,9 @@ wx.redirectTo({ url: 'test?id=1' }) ``` */ - redirectTo(option: RedirectToOption): void + redirectTo( + option: TOption, + ): PromisifySuccessResult /** [wx.removeSavedFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.removeSavedFile.html) * * 删除本地缓存文件 @@ -12349,7 +12519,9 @@ wx.getSavedFileList({ } }) ``` */ - removeSavedFile(option: WxRemoveSavedFileOption): void + removeSavedFile( + option: TOption, + ): PromisifySuccessResult /** [wx.removeStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorage.html) * * 从本地缓存中移除指定 key @@ -12373,7 +12545,9 @@ try { // Do something when catch error } ``` */ - removeStorage(option: RemoveStorageOption): void + removeStorage( + option: TOption, + ): PromisifySuccessResult /** [wx.removeStorageSync(string key)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorageSync.html) * * [wx.removeStorage](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorage.html) 的同步版本 @@ -12406,7 +12580,9 @@ try { * 移除 tabBar 某一项右上角的文本 * * 最低基础库: `1.9.0` */ - removeTabBarBadge(option: RemoveTabBarBadgeOption): void + removeTabBarBadge( + option: TOption, + ): PromisifySuccessResult /** [wx.reportAnalytics(string eventName, Object data)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/data-analysis/wx.reportAnalytics.html) * * 自定义分析数据上报接口。使用前,需要在小程序管理后台自定义分析中新建事件,配置好事件名与字段。 @@ -12451,7 +12627,7 @@ wx.reportMonitor('1', 1) ): void /** [wx.reportPerformance(Number id, Number value)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/wx.reportPerformance.html) * -* 自定义性能监控上报。使用前,需要在小程序管理后台配置。 详情参见[测速系统](#)指南。 +* 小程序测速上报。使用前,需要在小程序管理后台配置。 详情参见[小程序测速](#)指南。 * * **示例代码** * @@ -12485,7 +12661,9 @@ wx.requestPayment({ fail (res) { } }) ``` */ - requestPayment(option: RequestPaymentOption): void + requestPayment( + option: TOption, + ): PromisifySuccessResult /** [wx.requestSubscribeMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html) * * 调起客户端小程序订阅消息界面,返回用户订阅消息的操作结果。当用户勾选了订阅面板中的“总是保持以上选择,不再询问”时,模板消息会被添加到用户的小程序设置页,通过 [wx.getSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.getSetting.html) 接口可获取用户对相关模板消息的订阅状态。 @@ -12524,7 +12702,9 @@ wx.requestSubscribeMessage({ ``` * * 最低基础库: `2.4.4` */ - requestSubscribeMessage(option: RequestSubscribeMessageOption): void + requestSubscribeMessage( + option: TOption, + ): PromisifySuccessResult /** [wx.saveFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.saveFile.html) * * 保存文件到本地。注意:**saveFile 会把临时文件移动,因此调用成功后传入的 tempFilePath 将不可用** @@ -12550,7 +12730,9 @@ wx.chooseImage({ * * * 本地文件存储的大小限制为 10M */ - saveFile(option: WxSaveFileOption): void + saveFile( + option: TOption, + ): PromisifySuccessResult /** [wx.saveImageToPhotosAlbum(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html) * * 保存图片到系统相册。 @@ -12565,7 +12747,9 @@ wx.saveImageToPhotosAlbum({ ``` * * 最低基础库: `1.2.0` */ - saveImageToPhotosAlbum(option: SaveImageToPhotosAlbumOption): void + saveImageToPhotosAlbum( + option: TOption, + ): PromisifySuccessResult /** [wx.saveVideoToPhotosAlbum(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.saveVideoToPhotosAlbum.html) * * 保存视频到系统相册。支持mp4视频格式。 @@ -12583,7 +12767,9 @@ wx.saveVideoToPhotosAlbum({ ``` * * 最低基础库: `1.2.0` */ - saveVideoToPhotosAlbum(option: SaveVideoToPhotosAlbumOption): void + saveVideoToPhotosAlbum( + option: TOption, + ): PromisifySuccessResult /** [wx.scanCode(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/scan/wx.scanCode.html) * * 调起客户端扫码界面进行扫码 @@ -12607,7 +12793,9 @@ wx.scanCode({ } }) ``` */ - scanCode(option: ScanCodeOption): void + scanCode( + option: TOption, + ): PromisifySuccessResult /** [wx.seekBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.seekBackgroundAudio.html) * * 控制音乐播放进度。 @@ -12620,7 +12808,9 @@ wx.seekBackgroundAudio({ position: 30 }) ``` */ - seekBackgroundAudio(option: SeekBackgroundAudioOption): void + seekBackgroundAudio( + option: TOption, + ): PromisifySuccessResult /** [wx.sendHCEMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.sendHCEMessage.html) * * 发送 NFC 消息。仅在安卓系统下有效。 @@ -12645,7 +12835,9 @@ wx.startHCE({ ``` * * 最低基础库: `1.7.0` */ - sendHCEMessage(option: SendHCEMessageOption): void + sendHCEMessage( + option: TOption, + ): PromisifySuccessResult /** [wx.sendSocketMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.sendSocketMessage.html) * * 通过 WebSocket 连接发送数据。需要先 wx.connectSocket,并在 wx.onSocketOpen 回调之后才能发送。 @@ -12678,7 +12870,9 @@ function sendSocketMessage(msg) { } } ``` */ - sendSocketMessage(option: SendSocketMessageOption): void + sendSocketMessage( + option: TOption, + ): PromisifySuccessResult /** [wx.setBackgroundColor(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/background/wx.setBackgroundColor.html) * * 动态设置窗口的背景色 @@ -12698,13 +12892,17 @@ wx.setBackgroundColor({ ``` * * 最低基础库: `2.1.0` */ - setBackgroundColor(option: SetBackgroundColorOption): void + setBackgroundColor( + option: TOption, + ): PromisifySuccessResult /** [wx.setBackgroundFetchToken(object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.setBackgroundFetchToken.html) * * 设置自定义登录态,在周期性拉取数据时带上,便于第三方服务器验证请求合法性 * * 最低基础库: `2.8.0` */ - setBackgroundFetchToken(option: SetBackgroundFetchTokenOption): void + setBackgroundFetchToken( + option: TOption, + ): PromisifySuccessResult /** [wx.setBackgroundTextStyle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/background/wx.setBackgroundTextStyle.html) * * 动态设置下拉背景字体、loading 图的样式 @@ -12719,7 +12917,9 @@ wx.setBackgroundTextStyle({ ``` * * 最低基础库: `2.1.0` */ - setBackgroundTextStyle(option: SetBackgroundTextStyleOption): void + setBackgroundTextStyle( + option: TOption, + ): PromisifySuccessResult /** [wx.setClipboardData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.setClipboardData.html) * * 设置系统剪贴板的内容。调用成功后,会弹出 toast 提示"内容已复制",持续 1.5s @@ -12741,7 +12941,9 @@ wx.setClipboardData({ ``` * * 最低基础库: `1.1.0` */ - setClipboardData(option: SetClipboardDataOption): void + setClipboardData( + option: TOption, + ): PromisifySuccessResult /** [wx.setEnableDebug(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html) * * 设置是否打开调试开关。此开关对正式版也能生效。 @@ -12767,13 +12969,17 @@ wx.setEnableDebug({ * - 在正式版打开调试还有一种方法,就是先在开发版或体验版打开调试,再切到正式版就能看到vConsole。 * * 最低基础库: `1.4.0` */ - setEnableDebug(option: SetEnableDebugOption): void + setEnableDebug( + option: TOption, + ): PromisifySuccessResult /** [wx.setInnerAudioOption(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.setInnerAudioOption.html) * * 设置 [InnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.html) 的播放选项。设置之后对当前小程序全局生效。 * * 最低基础库: `2.3.0` */ - setInnerAudioOption(option: SetInnerAudioOption): void + setInnerAudioOption( + option: TOption, + ): PromisifySuccessResult /** [wx.setKeepScreenOn(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.setKeepScreenOn.html) * * 设置是否保持常亮状态。仅在当前小程序生效,离开小程序后设置失效。 @@ -12788,13 +12994,17 @@ wx.setKeepScreenOn({ ``` * * 最低基础库: `1.4.0` */ - setKeepScreenOn(option: SetKeepScreenOnOption): void + setKeepScreenOn( + option: TOption, + ): PromisifySuccessResult /** [wx.setNavigationBarColor(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.setNavigationBarColor.html) * * 设置页面导航条颜色 * * 最低基础库: `1.4.0` */ - setNavigationBarColor(option: SetNavigationBarColorOption): void + setNavigationBarColor( + option: TOption, + ): PromisifySuccessResult /** [wx.setNavigationBarTitle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.setNavigationBarTitle.html) * * 动态设置当前页面的标题 @@ -12807,13 +13017,17 @@ wx.setNavigationBarTitle({ title: '当前页面' }) ``` */ - setNavigationBarTitle(option: SetNavigationBarTitleOption): void + setNavigationBarTitle( + option: TOption, + ): PromisifySuccessResult /** [wx.setScreenBrightness(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.setScreenBrightness.html) * * 设置屏幕亮度 * * 最低基础库: `1.2.0` */ - setScreenBrightness(option: SetScreenBrightnessOption): void + setScreenBrightness( + option: TOption, + ): PromisifySuccessResult /** [wx.setStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorage.html) * * 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。 @@ -12832,7 +13046,9 @@ try { wx.setStorageSync('key', 'value') } catch (e) { } ``` */ - setStorage(option: SetStorageOption): void + setStorage( + option: TOption, + ): PromisifySuccessResult /** [wx.setStorageSync(string key, any data)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorageSync.html) * * [wx.setStorage](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorage.html) 的同步版本 @@ -12872,7 +13088,9 @@ wx.setTabBarBadge({ ``` * * 最低基础库: `1.9.0` */ - setTabBarBadge(option: SetTabBarBadgeOption): void + setTabBarBadge( + option: TOption, + ): PromisifySuccessResult /** [wx.setTabBarItem(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.setTabBarItem.html) * * 动态设置 tabBar 某一项的内容,`2.7.0` 起图片支持临时文件和网络文件。 @@ -12890,7 +13108,9 @@ wx.setTabBarItem({ ``` * * 最低基础库: `1.9.0` */ - setTabBarItem(option: SetTabBarItemOption): void + setTabBarItem( + option: TOption, + ): PromisifySuccessResult /** [wx.setTabBarStyle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.setTabBarStyle.html) * * 动态设置 tabBar 的整体样式 @@ -12908,7 +13128,9 @@ wx.setTabBarStyle({ ``` * * 最低基础库: `1.9.0` */ - setTabBarStyle(option?: SetTabBarStyleOption): void + setTabBarStyle( + option?: TOption, + ): PromisifySuccessResult /** [wx.setTopBarText(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/sticky/wx.setTopBarText.html) * * 动态设置置顶栏文字内容。只有当前小程序被置顶时能生效,如果当前小程序没有被置顶,也能调用成功,但是不会立即生效,只有在用户将这个小程序置顶后才换上设置的文字内容. @@ -12928,7 +13150,9 @@ wx.setTopBarText({ * - 调用成功后,需间隔 5s 才能再次调用此接口,如果在 5s 内再次调用此接口,会回调 fail,errMsg:"setTopBarText: fail invoke too frequently" * * 最低基础库: `1.4.3` */ - setTopBarText(option: SetTopBarTextOption): void + setTopBarText( + option: TOption, + ): PromisifySuccessResult /** [wx.setWifiList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.setWifiList.html) * * 设置 `wifiList` 中 AP 的相关信息。在 `onGetWifiList` 回调后调用,**iOS特有接口**。 @@ -12963,7 +13187,9 @@ wx.getWifiList() ``` * * 最低基础库: `1.6.0` */ - setWifiList(option: SetWifiListOption): void + setWifiList( + option: TOption, + ): PromisifySuccessResult /** [wx.showActionSheet(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showActionSheet.html) * * 显示操作菜单 @@ -12988,7 +13214,9 @@ wx.showActionSheet({ * * - Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel"; * - Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑 */ - showActionSheet(option: ShowActionSheetOption): void + showActionSheet( + option: TOption, + ): PromisifySuccessResult /** [wx.showLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showLoading.html) * * 显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框 @@ -13013,7 +13241,9 @@ setTimeout(function () { * - [wx.showLoading](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showLoading.html) 应与 [wx.hideLoading](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideLoading.html) 配对使用 * * 最低基础库: `1.1.0` */ - showLoading(option: ShowLoadingOption): void + showLoading( + option: TOption, + ): PromisifySuccessResult /** [wx.showModal(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showModal.html) * * 显示模态对话框 @@ -13040,17 +13270,25 @@ wx.showModal({ * * - Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel"; * - Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑 */ - showModal(option: ShowModalOption): void + showModal( + option: TOption, + ): PromisifySuccessResult /** [wx.showNavigationBarLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.showNavigationBarLoading.html) * * 在当前页面显示导航条加载动画 */ - showNavigationBarLoading(option?: ShowNavigationBarLoadingOption): void + showNavigationBarLoading< + TOption extends ShowNavigationBarLoadingOption + >( + option?: TOption, + ): PromisifySuccessResult /** [wx.showRedPackage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/redpackage/wx.showRedPackage.html) * * 拉取h5领取红包封面页。获取参考红包封面地址参考 [微信红包封面开发平台](https://cover.weixin.qq.com/cgi-bin/mmcover-bin/readtemplate?t=page%2Fdoc%2Fguide%2Fintroduce.html)。 * * 最低基础库: `2.10.0` */ - showRedPackage(option: ShowRedPackageOption): void + showRedPackage( + option: TOption, + ): PromisifySuccessResult /** [wx.showShareMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.showShareMenu.html) * * 显示当前页面的转发按钮 @@ -13065,19 +13303,25 @@ wx.showShareMenu({ ``` * * 最低基础库: `1.1.0` */ - showShareMenu(option: ShowShareMenuOption): void + showShareMenu( + option: TOption, + ): PromisifySuccessResult /** [wx.showTabBar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBar.html) * * 显示 tabBar * * 最低基础库: `1.9.0` */ - showTabBar(option: ShowTabBarOption): void + showTabBar( + option: TOption, + ): PromisifySuccessResult /** [wx.showTabBarRedDot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBarRedDot.html) * * 显示 tabBar 某一项的右上角的红点 * * 最低基础库: `1.9.0` */ - showTabBarRedDot(option: ShowTabBarRedDotOption): void + showTabBarRedDot( + option: TOption, + ): PromisifySuccessResult /** [wx.showToast(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html) * * 显示消息提示框 @@ -13098,7 +13342,9 @@ wx.showToast({ * * - [wx.showLoading](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showLoading.html) 和 [wx.showToast](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html) 同时只能显示一个 * - [wx.showToast](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html) 应与 [wx.hideToast](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideToast.html) 配对使用 */ - showToast(option: ShowToastOption): void + showToast( + option: TOption, + ): PromisifySuccessResult /** [wx.startAccelerometer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.startAccelerometer.html) * * 开始监听加速度数据。 @@ -13118,7 +13364,9 @@ wx.startAccelerometer({ * - 根据机型性能、当前 CPU 与内存的占用情况,`interval` 的设置与实际 `wx.onAccelerometerChange()` 回调函数的执行频率会有一些出入。 * * 最低基础库: `1.1.0` */ - startAccelerometer(option: StartAccelerometerOption): void + startAccelerometer( + option: TOption, + ): PromisifySuccessResult /** [wx.startBeaconDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.startBeaconDiscovery.html) * * 开始搜索附近的 iBeacon 设备 @@ -13133,7 +13381,9 @@ wx.startBeaconDiscovery({ ``` * * 最低基础库: `1.2.0` */ - startBeaconDiscovery(option: StartBeaconDiscoveryOption): void + startBeaconDiscovery( + option: TOption, + ): PromisifySuccessResult /** [wx.startBluetoothDevicesDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.startBluetoothDevicesDiscovery.html) * * 开始搜寻附近的蓝牙外围设备。**此操作比较耗费系统资源,请在搜索并连接到设备后调用 [wx.stopBluetoothDevicesDiscovery](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.stopBluetoothDevicesDiscovery.html) 方法停止搜索。** @@ -13154,9 +13404,11 @@ wx.startBluetoothDevicesDiscovery({ ``` * * 最低基础库: `1.1.0` */ - startBluetoothDevicesDiscovery( - option: StartBluetoothDevicesDiscoveryOption, - ): void + startBluetoothDevicesDiscovery< + TOption extends StartBluetoothDevicesDiscoveryOption + >( + option: TOption, + ): PromisifySuccessResult /** [wx.startCompass(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.startCompass.html) * * 开始监听罗盘数据 @@ -13169,21 +13421,27 @@ wx.startCompass() ``` * * 最低基础库: `1.1.0` */ - startCompass(option?: StartCompassOption): void + startCompass( + option?: TOption, + ): PromisifySuccessResult /** [wx.startDeviceMotionListening(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.startDeviceMotionListening.html) * * 开始监听设备方向的变化。 * * 最低基础库: `2.3.0` */ - startDeviceMotionListening( - option: StartDeviceMotionListeningOption, - ): void + startDeviceMotionListening< + TOption extends StartDeviceMotionListeningOption + >( + option: TOption, + ): PromisifySuccessResult /** [wx.startGyroscope(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.startGyroscope.html) * * 开始监听陀螺仪数据。 * * 最低基础库: `2.3.0` */ - startGyroscope(option: StartGyroscopeOption): void + startGyroscope( + option: TOption, + ): PromisifySuccessResult /** [wx.startHCE(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.startHCE.html) * * 初始化 NFC 模块。 @@ -13201,7 +13459,9 @@ wx.startHCE({ ``` * * 最低基础库: `1.7.0` */ - startHCE(option: StartHCEOption): void + startHCE( + option: TOption, + ): PromisifySuccessResult /** [wx.startLocalServiceDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.startLocalServiceDiscovery.html) * * 开始搜索局域网下的 mDNS 服务。搜索的结果会通过 wx.onLocalService* 事件返回。 @@ -13213,9 +13473,11 @@ wx.startHCE({ * 2. 在调用 wx.startLocalServiceDiscovery 后,在这次搜索行为停止后才能发起下次 wx.startLocalServiceDiscovery。停止本次搜索行为的操作包括调用 wx.stopLocalServiceDiscovery 和 30 秒后系统自动 stop 本次搜索。 * * 最低基础库: `2.4.0` */ - startLocalServiceDiscovery( - option: StartLocalServiceDiscoveryOption, - ): void + startLocalServiceDiscovery< + TOption extends StartLocalServiceDiscoveryOption + >( + option: TOption, + ): PromisifySuccessResult /** [wx.startLocationUpdate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdate.html) * * 开启小程序进入前台时接收位置消息 @@ -13226,7 +13488,9 @@ wx.startHCE({ * - 获取位置信息需配置[地理位置用途说明](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#permission)。 * * 最低基础库: `2.8.0` */ - startLocationUpdate(option?: StartLocationUpdateOption): void + startLocationUpdate( + option?: TOption, + ): PromisifySuccessResult /** [wx.startLocationUpdateBackground(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdateBackground.html) * * 开启小程序进入前后台时均接收位置消息,需引导用户开启[授权]((open-ability/authorize#后台定位))。授权以后,小程序在运行中或进入后台均可接受位置消息变化。 @@ -13239,9 +13503,11 @@ wx.startHCE({ * - 获取位置信息需配置[地理位置用途说明](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#permission)。 * * 最低基础库: `2.8.0` */ - startLocationUpdateBackground( - option?: StartLocationUpdateBackgroundOption, - ): void + startLocationUpdateBackground< + TOption extends StartLocationUpdateBackgroundOption + >( + option?: TOption, + ): PromisifySuccessResult /** [wx.startPullDownRefresh(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/pull-down-refresh/wx.startPullDownRefresh.html) * * 开始下拉刷新。调用后触发下拉刷新动画,效果与用户手动下拉刷新一致。 @@ -13254,7 +13520,9 @@ wx.startPullDownRefresh() ``` * * 最低基础库: `1.5.0` */ - startPullDownRefresh(option?: StartPullDownRefreshOption): void + startPullDownRefresh( + option?: TOption, + ): PromisifySuccessResult /** [wx.startRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.startRecord.html) * * 开始录音。当主动调用 [wx.stopRecord](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.stopRecord.html),或者录音超过1分钟时自动结束录音。当用户离开小程序时,此接口无法调用。 @@ -13272,7 +13540,9 @@ setTimeout(function () { wx.stopRecord() // 结束录音 }, 10000) ``` */ - startRecord(option: WxStartRecordOption): void + startRecord( + option: TOption, + ): PromisifySuccessResult /** [wx.startSoterAuthentication(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.startSoterAuthentication.html) * * 开始 SOTER 生物认证。验证流程请参考[说明](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/bio-auth.html)。 @@ -13322,7 +13592,11 @@ wx.startSoterAuthentication({ ``` * * 最低基础库: `1.5.0` */ - startSoterAuthentication(option: StartSoterAuthenticationOption): void + startSoterAuthentication< + TOption extends StartSoterAuthenticationOption + >( + option: TOption, + ): PromisifySuccessResult /** [wx.startWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.startWifi.html) * * 初始化 Wi-Fi 模块。 @@ -13340,7 +13614,9 @@ wx.startWifi({ ``` * * 最低基础库: `1.6.0` */ - startWifi(option?: StartWifiOption): void + startWifi( + option?: TOption, + ): PromisifySuccessResult /** [wx.stopAccelerometer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.stopAccelerometer.html) * * 停止监听加速度数据。 @@ -13353,7 +13629,9 @@ wx.stopAccelerometer() ``` * * 最低基础库: `1.1.0` */ - stopAccelerometer(option?: StopAccelerometerOption): void + stopAccelerometer( + option?: TOption, + ): PromisifySuccessResult /** [wx.stopBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.stopBackgroundAudio.html) * * 停止播放音乐。 @@ -13364,13 +13642,17 @@ wx.stopAccelerometer() * ```js wx.stopBackgroundAudio() ``` */ - stopBackgroundAudio(option?: StopBackgroundAudioOption): void + stopBackgroundAudio( + option?: TOption, + ): PromisifySuccessResult /** [wx.stopBeaconDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.stopBeaconDiscovery.html) * * 停止搜索附近的 iBeacon 设备 * * 最低基础库: `1.2.0` */ - stopBeaconDiscovery(option?: StopBeaconDiscoveryOption): void + stopBeaconDiscovery( + option?: TOption, + ): PromisifySuccessResult /** [wx.stopBluetoothDevicesDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.stopBluetoothDevicesDiscovery.html) * * 停止搜寻附近的蓝牙外围设备。若已经找到需要的蓝牙设备并不需要继续搜索时,建议调用该接口停止蓝牙搜索。 @@ -13388,9 +13670,11 @@ wx.stopBluetoothDevicesDiscovery({ ``` * * 最低基础库: `1.1.0` */ - stopBluetoothDevicesDiscovery( - option?: StopBluetoothDevicesDiscoveryOption, - ): void + stopBluetoothDevicesDiscovery< + TOption extends StopBluetoothDevicesDiscoveryOption + >( + option?: TOption, + ): PromisifySuccessResult /** [wx.stopCompass(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.stopCompass.html) * * 停止监听罗盘数据 @@ -13403,21 +13687,27 @@ wx.stopCompass() ``` * * 最低基础库: `1.1.0` */ - stopCompass(option?: StopCompassOption): void + stopCompass( + option?: TOption, + ): PromisifySuccessResult /** [wx.stopDeviceMotionListening(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.stopDeviceMotionListening.html) * * 停止监听设备方向的变化。 * * 最低基础库: `2.3.0` */ - stopDeviceMotionListening( - option?: StopDeviceMotionListeningOption, - ): void + stopDeviceMotionListening< + TOption extends StopDeviceMotionListeningOption + >( + option?: TOption, + ): PromisifySuccessResult /** [wx.stopGyroscope(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.stopGyroscope.html) * * 停止监听陀螺仪数据。 * * 最低基础库: `2.3.0` */ - stopGyroscope(option?: StopGyroscopeOption): void + stopGyroscope( + option?: TOption, + ): PromisifySuccessResult /** [wx.stopHCE(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.stopHCE.html) * * 关闭 NFC 模块。仅在安卓系统下有效。 @@ -13434,21 +13724,27 @@ wx.stopHCE({ ``` * * 最低基础库: `1.7.0` */ - stopHCE(option?: StopHCEOption): void + stopHCE( + option?: TOption, + ): PromisifySuccessResult /** [wx.stopLocalServiceDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.stopLocalServiceDiscovery.html) * * 停止搜索 mDNS 服务 * * 最低基础库: `2.4.0` */ - stopLocalServiceDiscovery( - option?: StopLocalServiceDiscoveryOption, - ): void + stopLocalServiceDiscovery< + TOption extends StopLocalServiceDiscoveryOption + >( + option?: TOption, + ): PromisifySuccessResult /** [wx.stopLocationUpdate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.stopLocationUpdate.html) * * 关闭监听实时位置变化,前后台都停止消息接收 * * 最低基础库: `2.8.0` */ - stopLocationUpdate(option?: StopLocationUpdateOption): void + stopLocationUpdate( + option?: TOption, + ): PromisifySuccessResult /** [wx.stopPullDownRefresh(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/pull-down-refresh/wx.stopPullDownRefresh.html) * * 停止当前页面下拉刷新。 @@ -13465,7 +13761,9 @@ Page({ ``` * * 最低基础库: `1.5.0` */ - stopPullDownRefresh(option?: StopPullDownRefreshOption): void + stopPullDownRefresh( + option?: TOption, + ): PromisifySuccessResult /** [wx.stopRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.stopRecord.html) * * 停止录音。 @@ -13483,7 +13781,9 @@ setTimeout(function () { wx.stopRecord() // 结束录音 }, 10000) ``` */ - stopRecord(option?: WxStopRecordOption): void + stopRecord( + option?: TOption, + ): PromisifySuccessResult /** [wx.stopVoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.stopVoice.html) * * 结束播放语音。 @@ -13503,7 +13803,9 @@ wx.startRecord({ } }) ``` */ - stopVoice(option?: StopVoiceOption): void + stopVoice( + option?: TOption, + ): PromisifySuccessResult /** [wx.stopWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.stopWifi.html) * * 关闭 Wi-Fi 模块。 @@ -13520,7 +13822,9 @@ wx.stopWifi({ ``` * * 最低基础库: `1.6.0` */ - stopWifi(option?: StopWifiOption): void + stopWifi( + option?: TOption, + ): PromisifySuccessResult /** [wx.switchTab(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.switchTab.html) * * 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面 @@ -13547,7 +13851,9 @@ wx.switchTab({ url: '/index' }) ``` */ - switchTab(option: SwitchTabOption): void + switchTab( + option: TOption, + ): PromisifySuccessResult /** [wx.updateShareMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.updateShareMenu.html) * * 更新转发属性 @@ -13563,19 +13869,25 @@ wx.updateShareMenu({ ``` * * 最低基础库: `1.2.0` */ - updateShareMenu(option: UpdateShareMenuOption): void + updateShareMenu( + option: TOption, + ): PromisifySuccessResult /** [wx.vibrateLong(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/vibrate/wx.vibrateLong.html) * * 使手机发生较长时间的振动(400 ms) * * 最低基础库: `1.2.0` */ - vibrateLong(option?: VibrateLongOption): void + vibrateLong( + option?: TOption, + ): PromisifySuccessResult /** [wx.vibrateShort(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/vibrate/wx.vibrateShort.html) * * 使手机发生较短时间的振动(15 ms)。仅在 iPhone `7 / 7 Plus` 以上及 Android 机型生效 * * 最低基础库: `1.2.0` */ - vibrateShort(option?: VibrateShortOption): void + vibrateShort( + option?: TOption, + ): PromisifySuccessResult /** [wx.writeBLECharacteristicValue(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.writeBLECharacteristicValue.html) * * 向低功耗蓝牙设备特征值中写入二进制数据。注意:必须设备的特征值支持 write 才可以成功调用。 @@ -13614,9 +13926,14 @@ wx.writeBLECharacteristicValue({ ``` * * 最低基础库: `1.1.0` */ - writeBLECharacteristicValue( - option: WriteBLECharacteristicValueOption, - ): void /** + writeBLECharacteristicValue< + TOption extends WriteBLECharacteristicValueOption + >( + option: TOption, + ): PromisifySuccessResult< + TOption, + WriteBLECharacteristicValueOption + > /** 小程序云开发 */ cloud: WxCloud /** From 4f1238745d8c64f1563558bcc2370201aeffbc50 Mon Sep 17 00:00:00 2001 From: SgLy <775150558@qq.com> Date: Thu, 26 Mar 2020 15:51:00 +0800 Subject: [PATCH 007/205] feat(baselib): definition for 2.10.3 closes #108 closes #109 closes #110 --- CHANGELOG.md | 3 + VERSIONS.md | 1 + package-lock.json | 2 +- package.json | 2 +- test/issue.test.ts | 6 +- types/wx/lib.wx.api.d.ts | 518 ++++++++++++++++++++++++++++++++++++--- 6 files changed, 495 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db43995..519fb6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2020-03-26 v2.10.3 +- 同步 API 定义到基础库 2.10.3 + ## 2020-03-18 v2.10.2-1 - 支持 API Promise 化调用(#105) diff --git a/VERSIONS.md b/VERSIONS.md index 4d50f06..e61f285 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -2,6 +2,7 @@ 基础库版本|npm 版本|命令 -|-|- +[v2.10.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-3-2020-03-06) | [2.10.3](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.3) | `npm install miniprogram-api-typings@2.10.3` [v2.10.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-2-2020-02-20) | [2.10.2-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.2-1) | `npm install miniprogram-api-typings@2.10.2-1` [v2.10.1](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-1-2020-01-14) | [2.10.1-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.1-1) | `npm install miniprogram-api-typings@2.10.1-1` [v2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-0-2019-12-24) | [2.10.0-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.0-1) | `npm install miniprogram-api-typings@2.10.0-1` diff --git a/package-lock.json b/package-lock.json index 6268323..23ff6de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.10.2-1", + "version": "2.10.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index d87082c..747dc82 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.10.2-1", + "version": "2.10.3", "description": "Type definitions for APIs of Wechat Mini Program in TypeScript", "main": "./index.d.ts", "types": "./index.d.ts", diff --git a/test/issue.test.ts b/test/issue.test.ts index f7a8b7b..a5bb48b 100644 --- a/test/issue.test.ts +++ b/test/issue.test.ts @@ -206,9 +206,11 @@ import WX = WechatMiniprogram // https://github.com/wechat-miniprogram/api-typings/issues/88 { - wx.canvasToTempFilePath({ canvas: '#canvas' }) + wx.createSelectorQuery().select('#canvas').fields({ node: true }).exec(res => { + wx.canvasToTempFilePath({ canvas: res[0].node }) + wx.canvasToTempFilePath({ canvas: res[0].node, quality: 0.5 }) + }) wx.canvasToTempFilePath({ canvasId: '' }) - wx.canvasToTempFilePath({ canvas: '', quality: 0.5 }) } // https://github.com/wechat-miniprogram/api-typings/issues/89 diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index 6bb6f18..c7b7c66 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -150,6 +150,27 @@ declare namespace WechatMiniprogram { /** 工作电话 */ workPhoneNumber?: string } + interface AddServiceOption { + /** 描述service的Object */ + service: BLEPeripheralService + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AddServiceCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: AddServiceFailCallback + /** 接口调用成功的回调函数 */ + success?: AddServiceSuccessCallback + } + /** 广播自定义参数 */ + interface AdvertiseReqObj { + /** 当前Service是否可连接 */ + connectable?: boolean + /** 广播中deviceName字段,默认为空 */ + deviceName?: string + /** 广播的制造商信息, 仅安卓支持 */ + manufacturerData?: ManufacturerData[] + /** 要广播的serviceUuid列表 */ + serviceUuids?: string[] + } /** 动画效果 */ interface AnimationOption { /** 动画变化时间,单位 ms */ @@ -245,10 +266,36 @@ declare namespace WechatMiniprogram { /** 设备特征值列表 */ interface BLECharacteristic { /** 该特征值支持的操作类型 */ - properties: Properties + properties: BLECharacteristicProperties /** 蓝牙设备特征值的 uuid */ uuid: string } + /** 该特征值支持的操作类型 */ + interface BLECharacteristicProperties { + /** 该特征值是否支持 indicate 操作 */ + indicate: boolean + /** 该特征值是否支持 notify 操作 */ + notify: boolean + /** 该特征值是否支持 read 操作 */ + read: boolean + /** 该特征值是否支持 write 操作 */ + write: boolean + } + interface BLEPeripheralServerCloseOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: BLEPeripheralServerCloseCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: BLEPeripheralServerCloseFailCallback + /** 接口调用成功的回调函数 */ + success?: BLEPeripheralServerCloseSuccessCallback + } + /** 描述service的Object */ + interface BLEPeripheralService { + /** characteristics列表 */ + characteristics: Characteristic[] + /** service 的 uuid */ + uuid: string + } /** 设备服务列表 */ interface BLEService { /** 该服务是否为主服务 */ @@ -534,7 +581,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb } interface CanvasToTempFilePathOption { /** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件实例 (canvas type="2d" 时使用该属性)。 */ - canvas?: string + canvas?: IAnyObject /** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件的 canvas-id */ canvasId?: string /** 接口调用结束的回调函数(调用成功、失败都会执行) */ @@ -585,6 +632,41 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb tempFilePath: string errMsg: string } + /** characteristics列表 */ + interface Characteristic { + /** Characteristic 的 uuid */ + uuid: string + /** 描述符数据 */ + descriptors?: Descriptor[] + /** 特征值权限 */ + permission?: CharacteristicPermission + /** 特征值支持的操作 */ + properties?: CharacteristicProperties + /** 特征值对应的二进制值 */ + value?: ArrayBuffer + } + /** 特征值权限 */ + interface CharacteristicPermission { + /** 加密读请求 */ + readEncryptionRequired?: boolean + /** 可读 */ + readable?: boolean + /** 加密写请求 */ + writeEncryptionRequired?: boolean + /** 可写 */ + writeable?: boolean + } + /** 特征值支持的操作 */ + interface CharacteristicProperties { + /** 回包 */ + indicate?: boolean + /** 订阅 */ + notify?: boolean + /** 读 */ + read?: boolean + /** 写 */ + write?: boolean + } interface CheckIsSoterEnrolledInDeviceOption { /** 认证方式 * @@ -660,6 +742,22 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 收货人姓名 */ userName: string } + interface ChooseContactOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ChooseContactCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ChooseContactFailCallback + /** 接口调用成功的回调函数 */ + success?: ChooseContactSuccessCallback + } + interface ChooseContactSuccessCallbackOption { + /** 联系人姓名 */ + displayName: string + /** 手机号 */ + phoneNumber: string + /** 选定联系人的所有手机号(部分 Android 系统只能选联系人而不能选特定手机号) */ + phoneNumberList: string + } /** 返回选择的文件的本地临时文件对象数组 */ interface ChooseFile { /** 选择的文件名称 */ @@ -918,18 +1016,6 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 接口调用成功的回调函数 */ success?: CloseBluetoothAdapterSuccessCallback } - interface CloseOption { - /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ - code?: number - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: CloseCompleteCallback - /** 接口调用失败的回调函数 */ - fail?: CloseFailCallback - /** 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于 123 字节的 UTF-8 文本(不是字符)。 */ - reason?: string - /** 接口调用成功的回调函数 */ - success?: CloseSuccessCallback - } interface CloseSocketOption { /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ code?: number @@ -1224,6 +1310,21 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 超时时间,单位ms,不填表示不会超时 */ timeout?: number } + interface CreateBLEPeripheralServerOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CreateBLEPeripheralServerCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: CreateBLEPeripheralServerFailCallback + /** 接口调用成功的回调函数 */ + success?: CreateBLEPeripheralServerSuccessCallback + } + interface CreateBLEPeripheralServerSuccessCallbackResult { + /** [BLEPeripheralServer](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.html) + * + * 外围设备的服务端。 */ + server: BLEPeripheralServer + errMsg: string + } /** 选项 */ interface CreateIntersectionObserverOption { /** 初始的相交比例,如果调用时检测到的相交比例与这个值不相等且达到阈值,则会触发一次监听器的回调函数。 */ @@ -1263,6 +1364,22 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 字体粗细,可选值为 normal / bold / 100 / 200../ 900 */ weight?: string } + /** 描述符数据 */ + interface Descriptor { + /** Descriptor 的 uuid */ + uuid: string + /** 描述符的权限 */ + permission?: DescriptorPermission + /** 描述符数据 */ + value?: ArrayBuffer + } + /** 描述符的权限 */ + interface DescriptorPermission { + /** 读 */ + read?: boolean + /** 写 */ + write?: boolean + } /** 指定 marker 移动到的目标点 */ interface DestinationOption { /** 纬度 */ @@ -1693,6 +1810,26 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb * - 'fail file not exist': 指定的 filePath 找不到文件; */ errMsg: string } + interface GetGroupEnterInfoOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetGroupEnterInfoCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetGroupEnterInfoFailCallback + /** 接口调用成功的回调函数 */ + success?: GetGroupEnterInfoSuccessCallback + } + interface GetGroupEnterInfoSuccessCallbackResult { + /** 敏感数据对应的云 ID,开通[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) + * + * 最低基础库: `2.7.0` */ + cloudID: string + /** 包括敏感数据在内的完整转发信息的加密数据,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */ + encryptedData: string + /** 错误信息 */ + errMsg: string + /** 加密算法的初始向量,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */ + iv: string + } interface GetHCEStateOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: GetHCEStateCompleteCallback @@ -2715,6 +2852,13 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: MakePhoneCallSuccessCallback } + /** 广播的制造商信息, 仅安卓支持 */ + interface ManufacturerData { + /** 制造商ID,0x 开头的十六进制 */ + manufacturerId: string + /** 制造商信息 */ + manufacturerSpecificData?: ArrayBuffer + } /** 要显示在可视区域内的坐标点列表 */ interface MapPostion { /** 纬度 */ @@ -2947,6 +3091,14 @@ innerAudioContext.onError((res) => { /** 蓝牙设备ID */ deviceId: string } + interface OnBLEPeripheralConnectionStateChangedCallbackResult { + /** 连接目前状态 */ + connected: boolean + /** 连接状态变化的设备 id */ + deviceId: string + /** server 的 uuid */ + serverId: string + } interface OnBackgroundFetchDataOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: OnBackgroundFetchDataCompleteCallback @@ -2983,6 +3135,24 @@ innerAudioContext.onError((res) => { /** 图像数据矩形的宽度 */ width: number } + interface OnCharacteristicReadRequestCallbackResult { + /** 唯一标识码,调用 writeCharacteristicValue 时使用 */ + callbackId: number + /** characteristic对应的uuid */ + characteristicId: string + /** service对应的uuid */ + serviceId: string + } + interface OnCharacteristicWriteRequestCallbackResult { + /** 唯一标识码,调用 writeCharacteristicValue 时使用 */ + callbackId: number + /** characteristic对应的uuid */ + characteristicId: string + /** service对应的uuid */ + serviceId: string + /** 请求写入的特征值数据 */ + value: ArrayBuffer + } interface OnCheckForUpdateCallbackResult { /** 是否有新版本 */ hasUpdate: boolean @@ -3206,6 +3376,8 @@ innerAudioContext.onError((res) => { * * 最低基础库: `1.4.0` */ fileType?: 'doc' | 'docx' | 'xls' | 'xlsx' | 'ppt' | 'pptx' | 'pdf' + /** 是否显示右上角菜单 */ + showMenu?: boolean /** 接口调用成功的回调函数 */ success?: OpenDocumentSuccessCallback } @@ -3347,17 +3519,6 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: PreviewImageSuccessCallback } - /** 该特征值支持的操作类型 */ - interface Properties { - /** 该特征值是否支持 indicate 操作 */ - indicate: boolean - /** 该特征值是否支持 notify 操作 */ - notify: boolean - /** 该特征值是否支持 read 操作 */ - read: boolean - /** 该特征值是否支持 write 操作 */ - write: boolean - } interface ReLaunchOption { /** 需要跳转的应用内页面路径 (代码包路径),路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2' */ url: string @@ -3623,6 +3784,16 @@ innerAudioContext.onError((res) => { * - 'fail file not exist': 指定的 tempFilePath 找不到文件; */ errMsg: string } + interface RemoveServiceOption { + /** service 的 uuid */ + serviceId: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RemoveServiceCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: RemoveServiceFailCallback + /** 接口调用成功的回调函数 */ + success?: RemoveServiceSuccessCallback + } interface RemoveStorageOption { /** 本地缓存中指定的 key */ key: string @@ -4252,6 +4423,18 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: SetWifiListSuccessCallback } + interface SetWindowSizeOption { + /** 窗口高度,以像素为单位 */ + height: number + /** 窗口宽度,以像素为单位 */ + width: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetWindowSizeCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetWindowSizeFailCallback + /** 接口调用成功的回调函数 */ + success?: SetWindowSizeSuccessCallback + } interface SetZoomOption { /** 缩放级别,范围[1, maxZoom]。zoom 可取小时,精确到小数后一位。maxZoom 可在 bindinitdone 返回值中获取。 */ zoom: number @@ -4406,6 +4589,18 @@ innerAudioContext.onError((res) => { /** 变化后的窗口宽度,单位 px */ windowWidth: number } + interface SocketTaskCloseOption { + /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ + code?: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SocketTaskCloseCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SocketTaskCloseFailCallback + /** 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于 123 字节的 UTF-8 文本(不是字符)。 */ + reason?: string + /** 接口调用成功的回调函数 */ + success?: SocketTaskCloseSuccessCallback + } interface SocketTaskOnCloseCallbackResult { /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ code: number @@ -4447,6 +4642,17 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: StartAccelerometerSuccessCallback } + interface StartAdvertisingObject { + /** 广播自定义参数 */ + advertiseRequest: AdvertiseReqObj + /** 广播功率 + * + * 可选值: + * - 'low': 功率低; + * - 'medium': 功率适中; + * - 'high': 功率高; */ + powerLevel?: 'low' | 'medium' | 'high' + } interface StartBeaconDiscoveryOption { /** iBeacon 设备广播的 uuid 列表 */ uuids: string[] @@ -4694,6 +4900,14 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: StopAccelerometerSuccessCallback } + interface StopAdvertisingOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopAdvertisingCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopAdvertisingFailCallback + /** 接口调用成功的回调函数 */ + success?: StopAdvertisingSuccessCallback + } interface StopBGMOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: StopBGMCompleteCallback @@ -5137,6 +5351,18 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: WriteBLECharacteristicValueSuccessCallback } + interface WriteCharacteristicValueObject { + /** characteristic对应的uuid */ + characteristicId: string + /** 是否需要通知主机value已更新 */ + needNotify: boolean + /** service 的 uuid */ + serviceId: string + /** 特征值对应的二进制值 */ + value: ArrayBuffer + /** 可选,处理回包时使用 */ + callbackId?: number + } interface WriteFileFailCallbackResult { /** 错误信息 * @@ -5518,6 +5744,80 @@ innerAudioContext.onError((res) => { src: string, ): void } + interface BLEPeripheralServer { + /** [BLEPeripheralServer.addService(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.addService.html) + * + * 添加服务。 + * + * 最低基础库: `2.10.3` */ + addService(option: AddServiceOption): void + /** [BLEPeripheralServer.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.close.html) + * + * 关闭当前服务端。 + * + * 最低基础库: `2.10.3` */ + close(option?: BLEPeripheralServerCloseOption): void + /** [BLEPeripheralServer.offCharacteristicReadRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicReadRequest.html) + * + * 取消监听已连接的设备请求读当前外围设备的特征值事件 + * + * 最低基础库: `2.10.3` */ + offCharacteristicReadRequest( + /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ + callback: OffCharacteristicReadRequestCallback, + ): void + /** [BLEPeripheralServer.offCharacteristicWriteRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicWriteRequest.html) + * + * 取消监听已连接的设备请求写当前外围设备的特征值事件 + * + * 最低基础库: `2.10.3` */ + offCharacteristicWriteRequest( + /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */ + callback: OffCharacteristicWriteRequestCallback, + ): void + /** [BLEPeripheralServer.onCharacteristicReadRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicReadRequest.html) + * + * 监听已连接的设备请求读当前外围设备的特征值事件。收到该消息后需要立刻调用 `writeCharacteristicValue` 写回数据,否则主机不会收到响应。 + * + * 最低基础库: `2.10.3` */ + onCharacteristicReadRequest( + /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ + callback: OnCharacteristicReadRequestCallback, + ): void + /** [BLEPeripheralServer.onCharacteristicWriteRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicWriteRequest.html) + * + * 监听已连接的设备请求写当前外围设备的特征值事件。收到该消息后需要立刻调用 `writeCharacteristicValue` 写回数据,否则主机不会收到响应。 + * + * 最低基础库: `2.10.3` */ + onCharacteristicWriteRequest( + /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */ + callback: OnCharacteristicWriteRequestCallback, + ): void + /** [BLEPeripheralServer.removeService(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.removeService.html) + * + * 移除服务。 + * + * 最低基础库: `2.10.3` */ + removeService(option: RemoveServiceOption): void + /** [BLEPeripheralServer.startAdvertising(Object Object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.startAdvertising.html) + * + * 开始广播本地创建的外围设备。 + * + * 最低基础库: `2.10.3` */ + startAdvertising(Object: StartAdvertisingObject): void + /** [BLEPeripheralServer.stopAdvertising(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.stopAdvertising.html) + * + * 停止广播。 + * + * 最低基础库: `2.10.3` */ + stopAdvertising(option?: StopAdvertisingOption): void + /** [BLEPeripheralServer.writeCharacteristicValue(Object Object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.writeCharacteristicValue.html) + * + * 往指定特征值写入数据,并通知已连接的主机,从机的特征值已发生变化,该接口会处理是走回包还是走订阅。 + * + * 最低基础库: `2.10.3` */ + writeCharacteristicValue(Object: WriteCharacteristicValueObject): void + } interface BackgroundAudioError { /** 错误信息 * @@ -8150,6 +8450,10 @@ Page({ * * 退出全屏 */ exitFullScreen(option?: ExitFullScreenOption): void + /** [LivePlayerContext.exitPictureInPicture()](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitPictureInPicture.html) + * + * 退出小窗,该方法可在任意页面调用。 */ + exitPictureInPicture(): void /** [LivePlayerContext.mute(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.mute.html) * * 静音 */ @@ -8927,7 +9231,7 @@ Component({ /** [SocketTask.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.close.html) * * 关闭 WebSocket 连接 */ - close(option: CloseOption): void + close(option: SocketTaskCloseOption): void /** [SocketTask.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onClose.html) * * 监听 WebSocket 连接关闭事件 */ @@ -10032,6 +10336,12 @@ wx.chooseAddress({ chooseAddress( option?: TOption, ): PromisifySuccessResult + /** [wx.chooseContact(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.chooseContact.html) + * + * 拉起手机通讯录,选择联系人。 + * + * 最低基础库: `2.8.0` */ + chooseContact(option?: ChooseContactOption): void /** [wx.chooseImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html) * * 从本地相册选择图片或使用相机拍照。 @@ -10334,6 +10644,16 @@ wx.createBLEConnection({ createBLEConnection( option: TOption, ): PromisifySuccessResult + /** [wx.createBLEPeripheralServer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.createBLEPeripheralServer.html) + * + * 建立本地作为外围设备的服务端,可创建多个。 + * + * 最低基础库: `2.10.3` */ + createBLEPeripheralServer< + TOption extends CreateBLEPeripheralServerOption + >( + option?: TOption, + ): PromisifySuccessResult /** [wx.getAvailableAudioSources(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.getAvailableAudioSources.html) * * 获取当前支持的音频输入源 @@ -10601,6 +10921,24 @@ wx.getFileInfo({ getFileInfo( option: TOption, ): PromisifySuccessResult + /** [wx.getGroupEnterInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.getGroupEnterInfo.html) +* +* 获取群工具栏启动信息 +* +* **示例代码** +* +* +* 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法)) 。 +* 获取得到的开放数据为以下 json 结构(其中 openGId 为当前群的唯一标识): +* +* ```json +{ + "openGId": "OPENGID" +} +``` +* +* 最低基础库: `2.10.4` */ + getGroupEnterInfo(option: GetGroupEnterInfoOption): void /** [wx.getHCEState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.getHCEState.html) * * 判断当前设备是否支持 HCE 能力。 @@ -11474,6 +11812,15 @@ wx.notifyBLECharacteristicValueChange({ /** 低功耗蓝牙连接状态的改变事件的回调函数 */ callback: (...args: any[]) => any, ): void + /** [wx.offBLEPeripheralConnectionStateChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBLEPeripheralConnectionStateChanged.html) + * + * 取消监听当前外围设备被连接或断开连接事件 + * + * 最低基础库: `2.10.3` */ + offBLEPeripheralConnectionStateChanged( + /** 当前外围设备被连接或断开连接事件的回调函数 */ + callback: OffBLEPeripheralConnectionStateChangedCallback, + ): void /** [wx.offBeaconServiceChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconServiceChange.html) * * 取消监听 iBeacon 服务状态变化事件 @@ -11799,6 +12146,15 @@ wx.onBLEConnectionStateChange(function(res) { /** 低功耗蓝牙连接状态的改变事件的回调函数 */ callback: OnBLEConnectionStateChangeCallback, ): void + /** [wx.onBLEPeripheralConnectionStateChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBLEPeripheralConnectionStateChanged.html) + * + * 监听当前外围设备被连接或断开连接事件 + * + * 最低基础库: `2.10.3` */ + onBLEPeripheralConnectionStateChanged( + /** 当前外围设备被连接或断开连接事件的回调函数 */ + callback: OnBLEPeripheralConnectionStateChangedCallback, + ): void /** [wx.onBackgroundAudioPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioPause.html) * * 监听音乐暂停事件。 */ @@ -12245,7 +12601,7 @@ wx.openCard({ ): PromisifySuccessResult /** [wx.openDocument(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.openDocument.html) * - * 新开页面打开文档 */ + * 新开页面打开文档。微信客户端 `7.0.12` 版本前默认显示右上角菜单按钮,之后的版本默认不显示,需主动传入 `showMenu`。 */ openDocument( option: TOption, ): PromisifySuccessResult @@ -13190,6 +13546,12 @@ wx.getWifiList() setWifiList( option: TOption, ): PromisifySuccessResult + /** [wx.setWindowSize(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.setWindowSize.html) + * + * 设置窗口大小,该接口仅适用于 PC 平台,使用细则请参见指南 + * + * 最低基础库: `2.10.1` */ + setWindowSize(option: SetWindowSizeOption): void /** [wx.showActionSheet(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showActionSheet.html) * * 显示操作菜单 @@ -13961,6 +14323,12 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type AddPhoneContactSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type AddServiceCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type AddServiceFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type AddServiceSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type AppendFileCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type AppendFileFailCallback = (result: AppendFileFailCallbackResult) => void @@ -13972,6 +14340,18 @@ wx.writeBLECharacteristicValue({ type AuthorizeFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type AuthorizeSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type BLEPeripheralServerCloseCompleteCallback = ( + res: GeneralCallbackResult, + ) => void + /** 接口调用失败的回调函数 */ + type BLEPeripheralServerCloseFailCallback = ( + res: GeneralCallbackResult, + ) => void + /** 接口调用成功的回调函数 */ + type BLEPeripheralServerCloseSuccessCallback = ( + res: GeneralCallbackResult, + ) => void /** 背景音频进入可播放状态事件的回调函数 */ type BackgroundAudioManagerOnCanplayCallback = ( res: GeneralCallbackResult, @@ -14139,6 +14519,14 @@ wx.writeBLECharacteristicValue({ result: ChooseAddressSuccessCallbackResult, ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type ChooseContactCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type ChooseContactFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type ChooseContactSuccessCallback = ( + option: ChooseContactSuccessCallbackOption, + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ChooseImageCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type ChooseImageFailCallback = (res: GeneralCallbackResult) => void @@ -14223,17 +14611,11 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type CloseBluetoothAdapterSuccessCallback = (res: BluetoothError) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type CloseCompleteCallback = (res: GeneralCallbackResult) => void - /** 接口调用失败的回调函数 */ - type CloseFailCallback = (res: GeneralCallbackResult) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type CloseSocketCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type CloseSocketFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type CloseSocketSuccessCallback = (res: GeneralCallbackResult) => void - /** 接口调用成功的回调函数 */ - type CloseSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type CompressImageCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ @@ -14269,6 +14651,18 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type CreateBLEConnectionSuccessCallback = (res: BluetoothError) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type CreateBLEPeripheralServerCompleteCallback = ( + res: GeneralCallbackResult, + ) => void + /** 接口调用失败的回调函数 */ + type CreateBLEPeripheralServerFailCallback = ( + res: GeneralCallbackResult, + ) => void + /** 接口调用成功的回调函数 */ + type CreateBLEPeripheralServerSuccessCallback = ( + result: CreateBLEPeripheralServerSuccessCallbackResult, + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type DownloadFileCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type DownloadFileFailCallback = (res: GeneralCallbackResult) => void @@ -14511,6 +14905,16 @@ wx.writeBLECharacteristicValue({ result: GetExtConfigSuccessCallbackResult, ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type GetGroupEnterInfoCompleteCallback = ( + res: GeneralCallbackResult, + ) => void + /** 接口调用失败的回调函数 */ + type GetGroupEnterInfoFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type GetGroupEnterInfoSuccessCallback = ( + result: GetGroupEnterInfoSuccessCallbackResult, + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetHCEStateCompleteCallback = (res: NFCError) => void /** 接口调用失败的回调函数 */ type GetHCEStateFailCallback = (res: NFCError) => void @@ -14986,12 +15390,24 @@ wx.writeBLECharacteristicValue({ ) => void /** 音频中断结束事件的回调函数 */ type OffAudioInterruptionEndCallback = (res: GeneralCallbackResult) => void + /** 当前外围设备被连接或断开连接事件的回调函数 */ + type OffBLEPeripheralConnectionStateChangedCallback = ( + res: GeneralCallbackResult, + ) => void /** iBeacon 服务状态变化事件的回调函数 */ type OffBeaconServiceChangeCallback = (res: GeneralCallbackResult) => void /** iBeacon 设备更新事件的回调函数 */ type OffBeaconUpdateCallback = (res: GeneralCallbackResult) => void /** 音频进入可以播放状态的事件的回调函数 */ type OffCanplayCallback = (res: GeneralCallbackResult) => void + /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ + type OffCharacteristicReadRequestCallback = ( + res: GeneralCallbackResult, + ) => void + /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */ + type OffCharacteristicWriteRequestCallback = ( + res: GeneralCallbackResult, + ) => void /** 音频自然播放至结束的事件的回调函数 */ type OffEndedCallback = (res: GeneralCallbackResult) => void /** 开始监听数据包消息的事件的回调函数 */ @@ -15057,6 +15473,10 @@ wx.writeBLECharacteristicValue({ type OnBLEConnectionStateChangeCallback = ( result: OnBLEConnectionStateChangeCallbackResult, ) => void + /** 当前外围设备被连接或断开连接事件的回调函数 */ + type OnBLEPeripheralConnectionStateChangedCallback = ( + result: OnBLEPeripheralConnectionStateChangedCallbackResult, + ) => void /** 音乐暂停事件的回调函数 */ type OnBackgroundAudioPauseCallback = (res: GeneralCallbackResult) => void /** 音乐播放事件的回调函数 */ @@ -15091,6 +15511,14 @@ wx.writeBLECharacteristicValue({ ) => void /** 回调函数 */ type OnCameraFrameCallback = (result: OnCameraFrameCallbackResult) => void + /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ + type OnCharacteristicReadRequestCallback = ( + result: OnCharacteristicReadRequestCallbackResult, + ) => void + /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */ + type OnCharacteristicWriteRequestCallback = ( + result: OnCharacteristicWriteRequestCallbackResult, + ) => void /** 向微信后台请求检查更新结果事件的回调函数 */ type OnCheckForUpdateCallback = ( result: OnCheckForUpdateCallbackResult, @@ -15341,6 +15769,12 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type RemoveFormatSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type RemoveServiceCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type RemoveServiceFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type RemoveServiceSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type RemoveStorageCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type RemoveStorageFailCallback = (res: GeneralCallbackResult) => void @@ -15649,6 +16083,12 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type SetWifiListSuccessCallback = (res: WifiError) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type SetWindowSizeCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type SetWindowSizeFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type SetWindowSizeSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SetZoomCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type SetZoomFailCallback = (res: GeneralCallbackResult) => void @@ -15718,6 +16158,12 @@ wx.writeBLECharacteristicValue({ type ShowToastFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type ShowToastSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type SocketTaskCloseCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type SocketTaskCloseFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type SocketTaskCloseSuccessCallback = (res: GeneralCallbackResult) => void /** WebSocket 连接关闭事件的回调函数 */ type SocketTaskOnCloseCallback = ( result: SocketTaskOnCloseCallbackResult, @@ -15875,6 +16321,12 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type StopAccelerometerSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type StopAdvertisingCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type StopAdvertisingFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type StopAdvertisingSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StopBGMCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type StopBGMFailCallback = (res: GeneralCallbackResult) => void From 806f66cbef4406b461e173d0545bd54333c8b362 Mon Sep 17 00:00:00 2001 From: Baran Date: Tue, 31 Mar 2020 11:24:29 +0800 Subject: [PATCH 008/205] fix(component): getOpenerEventChannel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用 Component 构造器构造页面时 无法调用 getOpenerEventChannel --- types/wx/lib.wx.component.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/wx/lib.wx.component.d.ts b/types/wx/lib.wx.component.d.ts index 9b7e2fa..387e923 100644 --- a/types/wx/lib.wx.component.d.ts +++ b/types/wx/lib.wx.component.d.ts @@ -242,6 +242,8 @@ declare namespace WechatMiniprogram { options: ClearAnimationOptions, callback: () => void, ): void + + getOpenerEventChannel(): EventChannel } interface ComponentOptions { From dad454b97a2877f7284a2954140780cbd97a3311 Mon Sep 17 00:00:00 2001 From: SgLy <775150558@qq.com> Date: Tue, 31 Mar 2020 17:50:19 +0800 Subject: [PATCH 009/205] test: add openerEventChannel test --- test/component.test.ts | 12 ++++++++++++ test/page.test.ts | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/test/component.test.ts b/test/component.test.ts index d8d70ed..47fe8fd 100644 --- a/test/component.test.ts +++ b/test/component.test.ts @@ -386,3 +386,15 @@ Component({ }, }, }) + +Component({ + methods: { + test() { + const channel = this.getOpenerEventChannel() + expectType(channel) + channel.emit('test', {}) + channel.on('xxx', () => {}) + expectError(channel.emit(1, 2)) + }, + }, +}) diff --git a/test/page.test.ts b/test/page.test.ts index 14825af..d3375f3 100644 --- a/test/page.test.ts +++ b/test/page.test.ts @@ -199,3 +199,13 @@ Page({ expectType(this.data.logs) }, }) + +Page({ + test() { + const channel = this.getOpenerEventChannel() + expectType(channel) + channel.emit('test', {}) + channel.on('xxx', () => {}) + expectError(channel.emit(1, 2)) + }, +}) From 0e9121a73d56952934c2e022f89c7d24fa5e1758 Mon Sep 17 00:00:00 2001 From: SgLy <775150558@qq.com> Date: Tue, 31 Mar 2020 18:42:34 +0800 Subject: [PATCH 010/205] refactor: remove redundant defs --- types/wx/lib.wx.component.d.ts | 1 - types/wx/lib.wx.page.d.ts | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/types/wx/lib.wx.component.d.ts b/types/wx/lib.wx.component.d.ts index 387e923..e3ee364 100644 --- a/types/wx/lib.wx.component.d.ts +++ b/types/wx/lib.wx.component.d.ts @@ -242,7 +242,6 @@ declare namespace WechatMiniprogram { options: ClearAnimationOptions, callback: () => void, ): void - getOpenerEventChannel(): EventChannel } diff --git a/types/wx/lib.wx.page.d.ts b/types/wx/lib.wx.page.d.ts index 5397b14..8b0743e 100644 --- a/types/wx/lib.wx.page.d.ts +++ b/types/wx/lib.wx.page.d.ts @@ -137,9 +137,7 @@ declare namespace WechatMiniprogram { type InstanceMethods = Component.InstanceMethods< D - > & { - getOpenerEventChannel(): EventChannel, - } + > interface Data { /** 页面的初始数据 From 371dda623be13c033ccfe14ab885a330c3a3c5fd Mon Sep 17 00:00:00 2001 From: creanme Date: Thu, 2 Apr 2020 08:47:36 +0800 Subject: [PATCH 011/205] feat(event): definition for event --- types/wx/lib.wx.event.d.ts | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 types/wx/lib.wx.event.d.ts diff --git a/types/wx/lib.wx.event.d.ts b/types/wx/lib.wx.event.d.ts new file mode 100644 index 0000000..7aedae9 --- /dev/null +++ b/types/wx/lib.wx.event.d.ts @@ -0,0 +1,53 @@ +declare namespace WechatMiniprogram { + interface Touch { + clientX: number + clientY: number + force: number + identifier: number + pageX: number + pageY: number + } + interface Event { + currentTarget: { + id: string, + dataset: { + [key: string]: string + }, + offsetTop: number, + offsetLeft: number + } + target: { + id: string, + dataset: { + [key: string]: string + }, + offsetTop: number, + offsetLeft: number + } + timeStamp: number + touches: Touch[] + mut: boolean + type: string + } + interface TapEvent extends Event { + changedTouches: [] + detail: { + x: number, + y: number + } + type: "tap" + } + + interface InputEvent extends Event { + changedTouches: [] + detail: { + cursor: number + keyCode: number + value: string + } + type: "input" + } +} + + + From 21e87e526f8cf9acfe5f8f4eba38040bd6ed03a5 Mon Sep 17 00:00:00 2001 From: creanme Date: Thu, 2 Apr 2020 09:02:32 +0800 Subject: [PATCH 012/205] feat(event): import event --- types/wx/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/wx/index.d.ts b/types/wx/index.d.ts index 52069b1..b7a79e4 100644 --- a/types/wx/index.d.ts +++ b/types/wx/index.d.ts @@ -26,6 +26,7 @@ SOFTWARE. /// /// /// +/// declare namespace WechatMiniprogram { type IAnyObject = Record From f3d700b1daf3b4fc571f8b9710bc7721982e8982 Mon Sep 17 00:00:00 2001 From: SgLy <775150558@qq.com> Date: Fri, 3 Apr 2020 17:03:38 +0800 Subject: [PATCH 013/205] feat: update cloud api --- types/wx/lib.wx.cloud.d.ts | 246 ++++++++++++++++++++++++++++++++----- 1 file changed, 213 insertions(+), 33 deletions(-) diff --git a/types/wx/lib.wx.cloud.d.ts b/types/wx/lib.wx.cloud.d.ts index 8ac213f..f2f7e73 100644 --- a/types/wx/lib.wx.cloud.d.ts +++ b/types/wx/lib.wx.cloud.d.ts @@ -226,14 +226,11 @@ declare namespace DB { class CollectionReference extends Query { readonly collectionName: string - readonly database: Database private constructor(name: string, database: Database) doc(docId: string | number): DocumentReference - // add(options: IAddDocumentOptions): Promise | void - add(options: OQ): void add(options: RQ): Promise } @@ -258,6 +255,13 @@ declare namespace DB { remove( options?: RQ, ): Promise + + watch(options: IWatchOptions): RealtimeListener + } + + class RealtimeListener { + // "And Now His Watch Is Ended" + close: () => Promise } class Query { @@ -276,6 +280,8 @@ declare namespace DB { count(options: OQ): void count(options?: RQ): Promise + + watch(options: IWatchOptions): RealtimeListener } interface DatabaseCommand { @@ -300,18 +306,154 @@ declare namespace DB { or( ...expressions: Array ): DatabaseLogicCommand + nor( + ...expressions: Array + ): DatabaseLogicCommand + not(expression: DatabaseLogicCommand): DatabaseLogicCommand + + exists(val: boolean): DatabaseQueryCommand + + mod(divisor: number, remainder: number): DatabaseQueryCommand + + all(val: any[]): DatabaseQueryCommand + elemMatch(val: any): DatabaseQueryCommand + size(val: number): DatabaseQueryCommand set(val: any): DatabaseUpdateCommand remove(): DatabaseUpdateCommand inc(val: number): DatabaseUpdateCommand mul(val: number): DatabaseUpdateCommand + min(val: number): DatabaseUpdateCommand + max(val: number): DatabaseUpdateCommand + rename(val: string): DatabaseUpdateCommand + bit(val: number): DatabaseUpdateCommand push(...values: any[]): DatabaseUpdateCommand pop(): DatabaseUpdateCommand shift(): DatabaseUpdateCommand unshift(...values: any[]): DatabaseUpdateCommand + addToSet(val: any): DatabaseUpdateCommand + pull(val: any): DatabaseUpdateCommand + pullAll(val: any): DatabaseUpdateCommand + + project: { + slice(val: number | [number, number]): DatabaseProjectionCommand, + } + + aggregate: { + __safe_props__?: Set + + abs(val: any): DatabaseAggregateCommand + add(val: any): DatabaseAggregateCommand + addToSet(val: any): DatabaseAggregateCommand + allElementsTrue(val: any): DatabaseAggregateCommand + and(val: any): DatabaseAggregateCommand + anyElementTrue(val: any): DatabaseAggregateCommand + arrayElemAt(val: any): DatabaseAggregateCommand + arrayToObject(val: any): DatabaseAggregateCommand + avg(val: any): DatabaseAggregateCommand + ceil(val: any): DatabaseAggregateCommand + cmp(val: any): DatabaseAggregateCommand + concat(val: any): DatabaseAggregateCommand + concatArrays(val: any): DatabaseAggregateCommand + cond(val: any): DatabaseAggregateCommand + convert(val: any): DatabaseAggregateCommand + dateFromParts(val: any): DatabaseAggregateCommand + dateToParts(val: any): DatabaseAggregateCommand + dateFromString(val: any): DatabaseAggregateCommand + dateToString(val: any): DatabaseAggregateCommand + dayOfMonth(val: any): DatabaseAggregateCommand + dayOfWeek(val: any): DatabaseAggregateCommand + dayOfYear(val: any): DatabaseAggregateCommand + divide(val: any): DatabaseAggregateCommand + eq(val: any): DatabaseAggregateCommand + exp(val: any): DatabaseAggregateCommand + filter(val: any): DatabaseAggregateCommand + first(val: any): DatabaseAggregateCommand + floor(val: any): DatabaseAggregateCommand + gt(val: any): DatabaseAggregateCommand + gte(val: any): DatabaseAggregateCommand + hour(val: any): DatabaseAggregateCommand + ifNull(val: any): DatabaseAggregateCommand + in(val: any): DatabaseAggregateCommand + indexOfArray(val: any): DatabaseAggregateCommand + indexOfBytes(val: any): DatabaseAggregateCommand + indexOfCP(val: any): DatabaseAggregateCommand + isArray(val: any): DatabaseAggregateCommand + isoDayOfWeek(val: any): DatabaseAggregateCommand + isoWeek(val: any): DatabaseAggregateCommand + isoWeekYear(val: any): DatabaseAggregateCommand + last(val: any): DatabaseAggregateCommand + let(val: any): DatabaseAggregateCommand + literal(val: any): DatabaseAggregateCommand + ln(val: any): DatabaseAggregateCommand + log(val: any): DatabaseAggregateCommand + log10(val: any): DatabaseAggregateCommand + lt(val: any): DatabaseAggregateCommand + lte(val: any): DatabaseAggregateCommand + ltrim(val: any): DatabaseAggregateCommand + map(val: any): DatabaseAggregateCommand + max(val: any): DatabaseAggregateCommand + mergeObjects(val: any): DatabaseAggregateCommand + meta(val: any): DatabaseAggregateCommand + min(val: any): DatabaseAggregateCommand + millisecond(val: any): DatabaseAggregateCommand + minute(val: any): DatabaseAggregateCommand + mod(val: any): DatabaseAggregateCommand + month(val: any): DatabaseAggregateCommand + multiply(val: any): DatabaseAggregateCommand + neq(val: any): DatabaseAggregateCommand + not(val: any): DatabaseAggregateCommand + objectToArray(val: any): DatabaseAggregateCommand + or(val: any): DatabaseAggregateCommand + pow(val: any): DatabaseAggregateCommand + push(val: any): DatabaseAggregateCommand + range(val: any): DatabaseAggregateCommand + reduce(val: any): DatabaseAggregateCommand + reverseArray(val: any): DatabaseAggregateCommand + rtrim(val: any): DatabaseAggregateCommand + second(val: any): DatabaseAggregateCommand + setDifference(val: any): DatabaseAggregateCommand + setEquals(val: any): DatabaseAggregateCommand + setIntersection(val: any): DatabaseAggregateCommand + setIsSubset(val: any): DatabaseAggregateCommand + setUnion(val: any): DatabaseAggregateCommand + size(val: any): DatabaseAggregateCommand + slice(val: any): DatabaseAggregateCommand + split(val: any): DatabaseAggregateCommand + sqrt(val: any): DatabaseAggregateCommand + stdDevPop(val: any): DatabaseAggregateCommand + stdDevSamp(val: any): DatabaseAggregateCommand + strcasecmp(val: any): DatabaseAggregateCommand + strLenBytes(val: any): DatabaseAggregateCommand + strLenCP(val: any): DatabaseAggregateCommand + substr(val: any): DatabaseAggregateCommand + substrBytes(val: any): DatabaseAggregateCommand + substrCP(val: any): DatabaseAggregateCommand + subtract(val: any): DatabaseAggregateCommand + sum(val: any): DatabaseAggregateCommand + switch(val: any): DatabaseAggregateCommand + toBool(val: any): DatabaseAggregateCommand + toDate(val: any): DatabaseAggregateCommand + toDecimal(val: any): DatabaseAggregateCommand + toDouble(val: any): DatabaseAggregateCommand + toInt(val: any): DatabaseAggregateCommand + toLong(val: any): DatabaseAggregateCommand + toObjectId(val: any): DatabaseAggregateCommand + toString(val: any): DatabaseAggregateCommand + toLower(val: any): DatabaseAggregateCommand + toUpper(val: any): DatabaseAggregateCommand + trim(val: any): DatabaseAggregateCommand + trunc(val: any): DatabaseAggregateCommand + type(val: any): DatabaseAggregateCommand + week(val: any): DatabaseAggregateCommand + year(val: any): DatabaseAggregateCommand + zip(val: any): DatabaseAggregateCommand, + } } + class DatabaseAggregateCommand {} + enum LOGIC_COMMANDS_LITERAL { AND = 'and', OR = 'or', @@ -320,22 +462,14 @@ declare namespace DB { } class DatabaseLogicCommand { - fieldName: string | InternalSymbol - operator: LOGIC_COMMANDS_LITERAL | string - operands: any[] - - _setFieldName(fieldName: string): DatabaseLogicCommand - - and( - ...expressions: Array - ): DatabaseLogicCommand - or( - ...expressions: Array - ): DatabaseLogicCommand + and(...expressions: DatabaseLogicCommand[]): DatabaseLogicCommand + or(...expressions: DatabaseLogicCommand[]): DatabaseLogicCommand + nor(...expressions: DatabaseLogicCommand[]): DatabaseLogicCommand + not(expression: DatabaseLogicCommand): DatabaseLogicCommand } enum QUERY_COMMANDS_LITERAL { - // normal + // comparison EQ = 'eq', NEQ = 'neq', GT = 'gt', @@ -348,13 +482,17 @@ declare namespace DB { GEO_NEAR = 'geoNear', GEO_WITHIN = 'geoWithin', GEO_INTERSECTS = 'geoIntersects', + // element + EXISTS = 'exists', + // evaluation + MOD = 'mod', + // array + ALL = 'all', + ELEM_MATCH = 'elemMatch', + SIZE = 'size', } class DatabaseQueryCommand extends DatabaseLogicCommand { - operator: QUERY_COMMANDS_LITERAL | string - - _setFieldName(fieldName: string): DatabaseQueryCommand - eq(val: any): DatabaseLogicCommand neq(val: any): DatabaseLogicCommand gt(val: any): DatabaseLogicCommand @@ -364,6 +502,14 @@ declare namespace DB { in(val: any[]): DatabaseLogicCommand nin(val: any[]): DatabaseLogicCommand + exists(val: boolean): DatabaseLogicCommand + + mod(divisor: number, remainder: number): DatabaseLogicCommand + + all(val: any[]): DatabaseLogicCommand + elemMatch(val: any): DatabaseLogicCommand + size(val: number): DatabaseLogicCommand + geoNear(options: IGeoNearCommandOptions): DatabaseLogicCommand geoWithin(options: IGeoWithinCommandOptions): DatabaseLogicCommand geoIntersects( @@ -371,30 +517,34 @@ declare namespace DB { ): DatabaseLogicCommand } + enum PROJECTION_COMMANDS_LITERAL { + SLICE = 'slice', + } + + class DatabaseProjectionCommand {} + enum UPDATE_COMMANDS_LITERAL { + // field SET = 'set', REMOVE = 'remove', INC = 'inc', MUL = 'mul', + MIN = 'min', + MAX = 'max', + RENAME = 'rename', + // bitwise + BIT = 'bit', + // array PUSH = 'push', POP = 'pop', SHIFT = 'shift', UNSHIFT = 'unshift', + ADD_TO_SET = 'addToSet', + PULL = 'pull', + PULL_ALL = 'pullAll', } - class DatabaseUpdateCommand { - fieldName: string | InternalSymbol - operator: UPDATE_COMMANDS_LITERAL - operands: any[] - - constructor( - operator: UPDATE_COMMANDS_LITERAL, - operands: any[], - fieldName?: string | InternalSymbol, - ) - - _setFieldName(fieldName: string): DatabaseUpdateCommand - } + class DatabaseUpdateCommand {} class Batch {} @@ -649,6 +799,36 @@ declare namespace DB { type IRemoveSingleDocumentOptions = IDBAPIParam + interface IWatchOptions { + // server realtime data init & change event + onChange: (snapshot: ISnapshot) => void + // error while connecting / listening + onError: (error: any) => void + } + + interface ISnapshot { + id: number + docChanges: ISingleDBEvent[] + docs: Record + type?: SnapshotType + } + + type SnapshotType = 'init' + + interface ISingleDBEvent { + id: number + dataType: DataType + queueType: QueueType + docId: string + doc: Record + updatedFields?: Record + removedFields?: string[] + } + + type DataType = 'init' | 'update' | 'replace' | 'add' | 'remove' | 'limit' + + type QueueType = 'init' | 'enqueue' | 'dequeue' | 'update' + interface IQueryCondition { [key: string]: any } From 9f70f5674696c089edaff76d247c470b91643b87 Mon Sep 17 00:00:00 2001 From: SgLy <775150558@qq.com> Date: Fri, 3 Apr 2020 17:17:25 +0800 Subject: [PATCH 014/205] chore: publish 2.10.3-1 --- CHANGELOG.md | 39 ++++++++++++++++++++++----------------- README-en.md | 5 +++++ README.md | 5 +++++ VERSIONS.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 6 files changed, 35 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 519fb6f..3b32e5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,34 +1,39 @@ +## 2020-04-03 v2.10.3-1 +- 补齐 `Component` 的 `getOpenerEventChannel` ([#112](https://github.com/wechat-miniprogram/api-typings/issues/113) by [@baranwang](https://github.com/baranwang)) +- 加入了部分事件的定义 ([#115](https://github.com/wechat-miniprogram/api-typings/issues/115) by [@zenml](https://github.com/zenml)) +- 更新了小程序·云开发的 API 定义 ([#92](https://github.com/wechat-miniprogram/api-typings/issues/92)) + ## 2020-03-26 v2.10.3 - 同步 API 定义到基础库 2.10.3 ## 2020-03-18 v2.10.2-1 -- 支持 API Promise 化调用(#105) +- 支持 API Promise 化调用 ([#105](https://github.com/wechat-miniprogram/api-typings/issues/105)) ## 2020-03-06 v2.10.2 - 同步 API 定义到基础库 2.10.2 ## 2020-02-10 v2.10.1-1 -- 允许重写部分全局变量(由 `const` 改为 `let`)(#102) -- 补齐 `Page` 上的 `options` 字段(#101 by @baranwang) +- 允许重写部分全局变量 (由 `const` 改为 `let`) ([#102](https://github.com/wechat-miniprogram/api-typings/issues/102)) +- 补齐 `Page` 上的 `options` 字段 ([#101](https://github.com/wechat-miniprogram/api-typings/issues/101) by [@baranwang](https://github.com/baranwang)) ## 2020-01-19 v2.10.1 - 同步 API 定义到基础库 2.10.1 -- 补齐 `Component` `selectOwnerComponent`, `animate`, `clearAnimation`(#96) -- 补齐 `App` `onUnhandledRejection`(#99) +- 补齐 `Component` `selectOwnerComponent`, `animate`, `clearAnimation` ([#96](https://github.com/wechat-miniprogram/api-typings/issues/96)) +- 补齐 `App` `onUnhandledRejection` ([#99](https://github.com/wechat-miniprogram/api-typings/issues/99)) ## 2020-01-07 v2.10.0-1 -- 修复接口错误(#95) +- 修复接口错误 ([#95](https://github.com/wechat-miniprogram/api-typings/issues/95)) ## 2020-01-07 v2.10.0 - 同步 API 定义到基础库 2.10.0 ## 2019-12-20 v2.9.4 - 同步 API 定义到基础库 2.9.4 -- 修正一些接口错误(#88,#89,#91) +- 修正一些接口错误 ([#88](https://github.com/wechat-miniprogram/api-typings/issues/88),[#89](https://github.com/wechat-miniprogram/api-typings/issues/89),[#91](https://github.com/wechat-miniprogram/api-typings/issues/91)) ## 2019-12-06 v2.9.3 - 同步 API 定义到基础库 2.9.3 -- 补齐 `Component` 纯数据字段(`pureDataPattern`) +- 补齐 `Component` 纯数据字段 (`pureDataPattern`) - 支持 `Component` 的属性监听器使用 `string` 类型 ## 2019-11-14 v2.9.2 @@ -43,17 +48,17 @@ ## 2019-10-10 v2.8.3-1 - 修复注释文档中不可用的链接 -- 组件实例类型支持 `Partial` 的自定义方法([用例](https://github.com/wechat-miniprogram/api-typings/blob/master/test/issue.test.ts#L170-L185)) +- 组件实例类型支持 `Partial` 的自定义方法 ([用例](https://github.com/wechat-miniprogram/api-typings/blob/master/test/issue.test.ts#L170-L185)) ## 2019-09-19 v2.8.3 - 同步 API 定义到基础库 2.8.3 -- `getApp` 支持范型(#77) -- 修正一些接口错误(#73, #75, #79) +- `getApp` 支持范型 ([#77](https://github.com/wechat-miniprogram/api-typings/issues/77)) +- 修正一些接口错误 ([#73](https://github.com/wechat-miniprogram/api-typings/issues/73), [#75](https://github.com/wechat-miniprogram/api-typings/issues/75), [#79](https://github.com/wechat-miniprogram/api-typings/issues/79)) - 补齐 `require`, `exports`, `module.exports` 定义,以支持在没有 `@types/node` 下编译 ## 2019-09-10 v2.8.2 - 同步 API 定义到基础库 2.8.2 -- 加强了参数为可选值的方法参数类型定义和注释(如 `FileSystemManager.appendFileSync` 的 `encoding`) +- 加强了参数为可选值的方法参数类型定义和注释 (如 `FileSystemManager.appendFileSync` 的 `encoding`) ## 2019-08-30 v2.8.1 - 同步 API 定义到基础库 2.8.1 @@ -77,19 +82,19 @@ - 不再向全局暴露 `IAnyObject`,收回到命名空间 `WechatMiniprogram` 内 - 对齐代码规范,使用 4 空格缩进,不再使用分号等 - 小幅改动 behavior, component 和 page 的定义,使其对 data 和 properties 等的类型推断更准确 -- 修复了一些其他问题(#60, #59, #48, #47, #45, #33, #13) +- 修复了一些其他问题 ([#60](https://github.com/wechat-miniprogram/api-typings/issues/60), [#59](https://github.com/wechat-miniprogram/api-typings/issues/59), [#48](https://github.com/wechat-miniprogram/api-typings/issues/48), [#47](https://github.com/wechat-miniprogram/api-typings/issues/47), [#45](https://github.com/wechat-miniprogram/api-typings/issues/45), [#33](https://github.com/wechat-miniprogram/api-typings/issues/33), [#13](https://github.com/wechat-miniprogram/api-typings/issues/13)) ## 2019-08-08 v2.7.7-2 -- 补齐了部分接口 fail 回调的错误码(#51) +- 补齐了部分接口 fail 回调的错误码 ([#51](https://github.com/wechat-miniprogram/api-typings/issues/51)) ## 2019-08-06 v2.7.7-1 -- 重写了 page, component 和 behavior 的定义,替换原来不完整的定义,使其更全面,更准确(#46, #40, #30, #28, #27) +- 重写了 page, component 和 behavior 的定义,替换原来不完整的定义,使其更全面,更准确 ([#46](https://github.com/wechat-miniprogram/api-typings/issues/46), [#40](https://github.com/wechat-miniprogram/api-typings/issues/40), [#30](https://github.com/wechat-miniprogram/api-typings/issues/30), [#28](https://github.com/wechat-miniprogram/api-typings/issues/28), [#27](https://github.com/wechat-miniprogram/api-typings/issues/27)) ## 2019-07-31 v2.7.7 - 同步 API 定义到基础库 2.7.7 - 将命名空间从 `Wx` 更改为更正式的 `WechatMiniprogram`,这是一个 **破坏性改动**,原本字面上引用了 `Wx` 命名空间的代码可能失效 -- 修复了云开发的定义无法使用的问题(#25, #32, #42) -- 修复了一些其它问题(#11, #35, #43) \ No newline at end of file +- 修复了云开发的定义无法使用的问题 ([#25](https://github.com/wechat-miniprogram/api-typings/issues/25), [#32](https://github.com/wechat-miniprogram/api-typings/issues/32), [#42](https://github.com/wechat-miniprogram/api-typings/issues/42)) +- 修复了一些其它问题 ([#11](https://github.com/wechat-miniprogram/api-typings/issues/11), [#35](https://github.com/wechat-miniprogram/api-typings/issues/35), [#43](https://github.com/wechat-miniprogram/api-typings/issues/43)) \ No newline at end of file diff --git a/README-en.md b/README-en.md index 2e34677..b958f51 100644 --- a/README-en.md +++ b/README-en.md @@ -37,6 +37,11 @@ Definitions of Wechat APIs (`lib.wx.api.d.ts`) are auto-generated together with Both PR and issue are welcomed for definitions of pages (`Page`), custom components (`Component`) and other else, since they are written manually. Help us improve this definition if you have any bug reports or suggestions! Thanks for contributing! +### Contributors + +- [Baran](https://github.com/baranwang) +- [MinLiang Zeng](https://github.com/zenml/) + ### Automated tests We use [`tsd`](https://github.com/SamVerschueren/tsd) to check if this definition is working properly. All test cases are under folder `test`. diff --git a/README.md b/README.md index 1ca655c..60a6365 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,11 @@ API 的定义文件(`lib.wx.api.d.ts`)是随 [文档](https://developers.wei 如果有针对页面(`Page`)、自定义组件(`Component`)等接口的 bug 和建议,欢迎 PR 或提一个 issue 给我们。非常感谢! +### 贡献者 + +- [Baran](https://github.com/baranwang) +- [MinLiang Zeng](https://github.com/zenml/) + ### 测试 本定义文件使用 [`tsd`](https://github.com/SamVerschueren/tsd) 进行测试,所有的测试样例放在 `test` 目录下。 diff --git a/VERSIONS.md b/VERSIONS.md index e61f285..6dcc949 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -2,7 +2,7 @@ 基础库版本|npm 版本|命令 -|-|- -[v2.10.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-3-2020-03-06) | [2.10.3](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.3) | `npm install miniprogram-api-typings@2.10.3` +[v2.10.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-3-2020-03-06) | [2.10.3-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.3-1) | `npm install miniprogram-api-typings@2.10.3-1` [v2.10.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-2-2020-02-20) | [2.10.2-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.2-1) | `npm install miniprogram-api-typings@2.10.2-1` [v2.10.1](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-1-2020-01-14) | [2.10.1-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.1-1) | `npm install miniprogram-api-typings@2.10.1-1` [v2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-0-2019-12-24) | [2.10.0-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.0-1) | `npm install miniprogram-api-typings@2.10.0-1` diff --git a/package-lock.json b/package-lock.json index 23ff6de..646bfc0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.10.3", + "version": "2.10.3-1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 747dc82..fe00371 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.10.3", + "version": "2.10.3-1", "description": "Type definitions for APIs of Wechat Mini Program in TypeScript", "main": "./index.d.ts", "types": "./index.d.ts", From cfe8a0c8a0e8adeaefd5f4320ebe848aab61c969 Mon Sep 17 00:00:00 2001 From: Garfield Lee Date: Sat, 18 Apr 2020 14:20:07 +0800 Subject: [PATCH 015/205] fix(animation): fix animation.export() return types --- types/wx/lib.wx.api.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index c7b7c66..cd1d84c 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -5504,7 +5504,9 @@ innerAudioContext.onError((res) => { /** [Array.<Object> Animation.export()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.export.html) * * 导出动画队列。**export 方法每次调用后会清掉之前的动画操作。** */ - export(): IAnyObject[] + export(): { + actions: IAnyObject[] + } /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.backgroundColor(string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.backgroundColor.html) * * 设置背景色 */ From 207a536d36c1eefcc5bca2a4f5e75c8f65e6ab77 Mon Sep 17 00:00:00 2001 From: SgLy <775150558@qq.com> Date: Mon, 20 Apr 2020 21:38:00 +0800 Subject: [PATCH 016/205] feat(baselib): definition for 2.10.4 --- CHANGELOG.md | 5 + VERSIONS.md | 1 + package-lock.json | 818 ++++++------ package.json | 2 +- test/issue.test.ts | 11 +- types/wx/index.d.ts | 8 +- types/wx/lib.wx.api.d.ts | 2126 ++++++++++++++------------------ types/wx/lib.wx.behavior.d.ts | 2 +- types/wx/lib.wx.cloud.d.ts | 36 +- types/wx/lib.wx.component.d.ts | 40 +- types/wx/lib.wx.event.d.ts | 43 +- types/wx/lib.wx.page.d.ts | 14 +- 12 files changed, 1444 insertions(+), 1662 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b32e5f..c055912 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2020-04-20 v2.10.4 +- 同步 API 定义到基础库 2.10.4 +- 在之前的版本中,分属于不同接口的两个 interface / callback 即使完全相同,也会拥有不同的名字。在这次更新中,他们将合并为同一个(如 `FileSystemManagerGetFileInfoCompleteCallback` 和 `WxGetFileInfoCompleteCallback` 都变成了 `GetFileInfoCompleteCallback`)。这是一个 **破坏性改动**,原本字面上引用了这些 interface / callback 的代码可能会报错。 +- 修复了一些取消监听接口(off callback)的参数错误 ([#120](https://github.com/wechat-miniprogram/api-typings/issues/120)) + ## 2020-04-03 v2.10.3-1 - 补齐 `Component` 的 `getOpenerEventChannel` ([#112](https://github.com/wechat-miniprogram/api-typings/issues/113) by [@baranwang](https://github.com/baranwang)) - 加入了部分事件的定义 ([#115](https://github.com/wechat-miniprogram/api-typings/issues/115) by [@zenml](https://github.com/zenml)) diff --git a/VERSIONS.md b/VERSIONS.md index 6dcc949..2fdb234 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -2,6 +2,7 @@ 基础库版本|npm 版本|命令 -|-|- +[v2.10.4](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-4-2020-03-24) | [2.10.4](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.4) | `npm install miniprogram-api-typings@2.10.4` [v2.10.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-3-2020-03-06) | [2.10.3-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.3-1) | `npm install miniprogram-api-typings@2.10.3-1` [v2.10.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-2-2020-02-20) | [2.10.2-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.2-1) | `npm install miniprogram-api-typings@2.10.2-1` [v2.10.1](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-1-2020-01-14) | [2.10.1-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.1-1) | `npm install miniprogram-api-typings@2.10.1-1` diff --git a/package-lock.json b/package-lock.json index 646bfc0..0712125 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,33 +1,39 @@ { "name": "miniprogram-api-typings", - "version": "2.10.3-1", + "version": "2.10.4", "lockfileVersion": 1, "requires": true, "dependencies": { "@babel/code-frame": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", - "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", + "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", "dev": true, "requires": { - "@babel/highlight": "^7.0.0" + "@babel/highlight": "^7.8.3" } }, + "@babel/helper-validator-identifier": { + "version": "7.9.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz", + "integrity": "sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g==", + "dev": true + }, "@babel/highlight": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", - "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", + "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", "dev": true, "requires": { + "@babel/helper-validator-identifier": "^7.9.0", "chalk": "^2.0.0", - "esutils": "^2.0.2", "js-tokens": "^4.0.0" } }, "@mrmlnc/readdir-enhanced": { "version": "2.2.1", - "resolved": "http://r.tnpm.oa.com/@mrmlnc/readdir-enhanced/download/@mrmlnc/readdir-enhanced-2.2.1.tgz", - "integrity": "sha1-UkryQNGjYFJ7cwR17PoTRKpUDd4=", + "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", + "integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==", "dev": true, "requires": { "call-me-maybe": "^1.0.1", @@ -36,20 +42,20 @@ }, "@nodelib/fs.stat": { "version": "1.1.3", - "resolved": "http://r.tnpm.oa.com/@nodelib/fs.stat/download/@nodelib/fs.stat-1.1.3.tgz", - "integrity": "sha1-K1o6s/kYzKSKjHVMCBaOPwPrphs=", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz", + "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==", "dev": true }, "@types/events": { "version": "3.0.0", - "resolved": "http://r.tnpm.oa.com/@types/events/download/@types/events-3.0.0.tgz", - "integrity": "sha1-KGLz9Yqaf3w+eNefEw3U1xwlwqc=", + "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", + "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", "dev": true }, "@types/glob": { "version": "7.1.1", - "resolved": "http://r.tnpm.oa.com/@types/glob/download/@types/glob-7.1.1.tgz", - "integrity": "sha1-qlmhxuP7xCHgfM0xqUTDDrpSFXU=", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", + "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", "dev": true, "requires": { "@types/events": "*", @@ -59,19 +65,19 @@ }, "@types/minimatch": { "version": "3.0.3", - "resolved": "http://r.tnpm.oa.com/@types/minimatch/download/@types/minimatch-3.0.3.tgz", - "integrity": "sha1-PcoOPzOyAPx9ETnAzZbBJoyt/Z0=", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", "dev": true }, "@types/node": { - "version": "12.12.14", - "resolved": "http://r.tnpm.oa.com/@types/node/download/@types/node-12.12.14.tgz", - "integrity": "sha1-HB1uPHXbpGbgMmlI1W6L1yoZA9I=", + "version": "13.13.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.0.tgz", + "integrity": "sha512-WE4IOAC6r/yBZss1oQGM5zs2D7RuKR6Q+w+X2SouPofnWn+LbCqClRyhO3ZE7Ix8nmFgo/oVuuE01cJT2XB13A==", "dev": true }, "ansi-align": { "version": "2.0.0", - "resolved": "http://r.tnpm.oa.com/ansi-align/download/ansi-align-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz", "integrity": "sha1-w2rsy6VjuJzrVW82kPCx2eNUf38=", "dev": true, "requires": { @@ -80,13 +86,13 @@ }, "ansi-escapes": { "version": "2.0.0", - "resolved": "http://r.tnpm.oa.com/ansi-escapes/download/ansi-escapes-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-2.0.0.tgz", "integrity": "sha1-W65SvkJIeN2Xg+iRDj/Cki6DyBs=", "dev": true }, "ansi-regex": { "version": "3.0.0", - "resolved": "http://r.tnpm.oa.com/ansi-regex/download/ansi-regex-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, @@ -110,31 +116,31 @@ }, "arr-diff": { "version": "4.0.0", - "resolved": "http://r.tnpm.oa.com/arr-diff/download/arr-diff-4.0.0.tgz", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", "dev": true }, "arr-flatten": { "version": "1.1.0", - "resolved": "http://r.tnpm.oa.com/arr-flatten/download/arr-flatten-1.1.0.tgz", - "integrity": "sha1-NgSLv/TntH4TZkQxbJlmnqWukfE=", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", "dev": true }, "arr-union": { "version": "3.1.0", - "resolved": "http://r.tnpm.oa.com/arr-union/download/arr-union-3.1.0.tgz", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", "dev": true }, "array-find-index": { "version": "1.0.2", - "resolved": "http://r.tnpm.oa.com/array-find-index/download/array-find-index-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", "dev": true }, "array-union": { "version": "1.0.2", - "resolved": "http://r.tnpm.oa.com/array-union/download/array-union-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", "dev": true, "requires": { @@ -143,32 +149,32 @@ }, "array-uniq": { "version": "1.0.3", - "resolved": "http://r.tnpm.oa.com/array-uniq/download/array-uniq-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", "dev": true }, "array-unique": { "version": "0.3.2", - "resolved": "http://r.tnpm.oa.com/array-unique/download/array-unique-0.3.2.tgz", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", "dev": true }, "arrify": { "version": "1.0.1", - "resolved": "http://r.tnpm.oa.com/arrify/download/arrify-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", "dev": true }, "assign-symbols": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/assign-symbols/download/assign-symbols-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", "dev": true }, "atob": { "version": "2.1.2", - "resolved": "http://r.tnpm.oa.com/atob/download/atob-2.1.2.tgz", - "integrity": "sha1-bZUX654DDSQ2ZmZR6GvZ9vE1M8k=", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", "dev": true }, "balanced-match": { @@ -179,8 +185,8 @@ }, "base": { "version": "0.11.2", - "resolved": "http://r.tnpm.oa.com/base/download/base-0.11.2.tgz", - "integrity": "sha1-e95c7RRbbVUakNuH+DxVi060io8=", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", "dev": true, "requires": { "cache-base": "^1.0.1", @@ -194,7 +200,7 @@ "dependencies": { "define-property": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/define-property/download/define-property-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "dev": true, "requires": { @@ -203,8 +209,8 @@ }, "is-accessor-descriptor": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/is-accessor-descriptor/download/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha1-FpwvbT3x+ZJhgHI2XJsOofaHhlY=", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "dev": true, "requires": { "kind-of": "^6.0.0" @@ -212,8 +218,8 @@ }, "is-data-descriptor": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/is-data-descriptor/download/is-data-descriptor-1.0.0.tgz", - "integrity": "sha1-2Eh2Mh0Oet0DmQQGq7u9NrqSaMc=", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "dev": true, "requires": { "kind-of": "^6.0.0" @@ -221,8 +227,8 @@ }, "is-descriptor": { "version": "1.0.2", - "resolved": "http://r.tnpm.oa.com/is-descriptor/download/is-descriptor-1.0.2.tgz", - "integrity": "sha1-OxWXRqZmBLBPjIFSS6NlxfFNhuw=", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "dev": true, "requires": { "is-accessor-descriptor": "^1.0.0", @@ -234,8 +240,8 @@ }, "boxen": { "version": "1.3.0", - "resolved": "http://r.tnpm.oa.com/boxen/download/boxen-1.3.0.tgz", - "integrity": "sha1-VcbDmouljZxhrSLNh3Uy3rZlogs=", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.3.0.tgz", + "integrity": "sha512-TNPjfTr432qx7yOjQyaXm3dSR0MH9vXp7eT1BFSl/C51g+EFnOR9hTg1IreahGBmDNCehscshe45f+C1TBZbLw==", "dev": true, "requires": { "ansi-align": "^2.0.0", @@ -259,8 +265,8 @@ }, "braces": { "version": "2.3.2", - "resolved": "http://r.tnpm.oa.com/braces/download/braces-2.3.2.tgz", - "integrity": "sha1-WXn9PxTNUxVl5fot8av/8d+u5yk=", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", "dev": true, "requires": { "arr-flatten": "^1.1.0", @@ -277,7 +283,7 @@ "dependencies": { "extend-shallow": { "version": "2.0.1", - "resolved": "http://r.tnpm.oa.com/extend-shallow/download/extend-shallow-2.0.1.tgz", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { @@ -294,8 +300,8 @@ }, "cache-base": { "version": "1.0.1", - "resolved": "http://r.tnpm.oa.com/cache-base/download/cache-base-1.0.1.tgz", - "integrity": "sha1-Cn9GQWgxyLZi7jb+TnxZ129marI=", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", "dev": true, "requires": { "collection-visit": "^1.0.0", @@ -311,19 +317,19 @@ }, "call-me-maybe": { "version": "1.0.1", - "resolved": "http://r.tnpm.oa.com/call-me-maybe/download/call-me-maybe-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", "integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=", "dev": true }, "camelcase": { "version": "4.1.0", - "resolved": "http://r.tnpm.oa.com/camelcase/download/camelcase-4.1.0.tgz", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true }, "camelcase-keys": { "version": "4.2.0", - "resolved": "http://r.tnpm.oa.com/camelcase-keys/download/camelcase-keys-4.2.0.tgz", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.2.0.tgz", "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", "dev": true, "requires": { @@ -334,8 +340,8 @@ }, "capture-stack-trace": { "version": "1.0.1", - "resolved": "http://r.tnpm.oa.com/capture-stack-trace/download/capture-stack-trace-1.0.1.tgz", - "integrity": "sha1-psC74fOPOqC5Ijjstv9Cw0TUE10=", + "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.1.tgz", + "integrity": "sha512-mYQLZnx5Qt1JgB1WEiMCf2647plpGeQ2NMR/5L0HNZzGQo4fuSPnK+wjfPnKZV0aiJDgzmWqqkV/g7JD+DW0qw==", "dev": true }, "chalk": { @@ -351,14 +357,14 @@ }, "ci-info": { "version": "1.6.0", - "resolved": "http://r.tnpm.oa.com/ci-info/download/ci-info-1.6.0.tgz", - "integrity": "sha1-LKINu5zrMtRSSmgzAzE/AwSx5Jc=", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.6.0.tgz", + "integrity": "sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==", "dev": true }, "class-utils": { "version": "0.3.6", - "resolved": "http://r.tnpm.oa.com/class-utils/download/class-utils-0.3.6.tgz", - "integrity": "sha1-+TNprouafOAv1B+q0MqDAzGQxGM=", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", "dev": true, "requires": { "arr-union": "^3.1.0", @@ -369,7 +375,7 @@ "dependencies": { "define-property": { "version": "0.2.5", - "resolved": "http://r.tnpm.oa.com/define-property/download/define-property-0.2.5.tgz", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { @@ -380,13 +386,13 @@ }, "cli-boxes": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/cli-boxes/download/cli-boxes-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz", "integrity": "sha1-T6kXw+WclKAEzWH47lCdplFocUM=", "dev": true }, "collection-visit": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/collection-visit/download/collection-visit-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", "dev": true, "requires": { @@ -410,15 +416,15 @@ "dev": true }, "commander": { - "version": "2.20.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.1.tgz", - "integrity": "sha512-cCuLsMhJeWQ/ZpsFTbE765kvVfoeSddc4nU3up4fV+fDBcfUXnbITJ+JzhkdjzOqhURjZgujxaioam4RM9yGUg==", + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, "component-emitter": { "version": "1.3.0", - "resolved": "http://r.tnpm.oa.com/component-emitter/download/component-emitter-1.3.0.tgz", - "integrity": "sha1-FuQHD7qK4ptnnyIVhT7hgasuq8A=", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", "dev": true }, "concat-map": { @@ -429,8 +435,8 @@ }, "configstore": { "version": "3.1.2", - "resolved": "http://r.tnpm.oa.com/configstore/download/configstore-3.1.2.tgz", - "integrity": "sha1-xvJd767vJt8S3TNBSwAf6BpUP48=", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.2.tgz", + "integrity": "sha512-vtv5HtGjcYUgFrXc6Kx747B83MRRVS5R1VTEQoXvuP+kMI+if6uywV0nDGoiydJRy4yk7h9od5Og0kxx4zUXmw==", "dev": true, "requires": { "dot-prop": "^4.1.0", @@ -443,13 +449,13 @@ }, "copy-descriptor": { "version": "0.1.1", - "resolved": "http://r.tnpm.oa.com/copy-descriptor/download/copy-descriptor-0.1.1.tgz", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", "dev": true }, "create-error-class": { "version": "3.0.2", - "resolved": "http://r.tnpm.oa.com/create-error-class/download/create-error-class-3.0.2.tgz", + "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", "integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=", "dev": true, "requires": { @@ -458,7 +464,7 @@ }, "cross-spawn": { "version": "5.1.0", - "resolved": "http://r.tnpm.oa.com/cross-spawn/download/cross-spawn-5.1.0.tgz", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "dev": true, "requires": { @@ -469,13 +475,13 @@ }, "crypto-random-string": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/crypto-random-string/download/crypto-random-string-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz", "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=", "dev": true }, "currently-unhandled": { "version": "0.4.1", - "resolved": "http://r.tnpm.oa.com/currently-unhandled/download/currently-unhandled-0.4.1.tgz", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", "dev": true, "requires": { @@ -484,8 +490,8 @@ }, "debug": { "version": "2.6.9", - "resolved": "http://r.tnpm.oa.com/debug/download/debug-2.6.9.tgz", - "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, "requires": { "ms": "2.0.0" @@ -493,13 +499,13 @@ }, "decamelize": { "version": "1.2.0", - "resolved": "http://r.tnpm.oa.com/decamelize/download/decamelize-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, "decamelize-keys": { "version": "1.1.0", - "resolved": "http://r.tnpm.oa.com/decamelize-keys/download/decamelize-keys-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz", "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", "dev": true, "requires": { @@ -509,7 +515,7 @@ "dependencies": { "map-obj": { "version": "1.0.1", - "resolved": "http://r.tnpm.oa.com/map-obj/download/map-obj-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", "dev": true } @@ -517,20 +523,20 @@ }, "decode-uri-component": { "version": "0.2.0", - "resolved": "http://r.tnpm.oa.com/decode-uri-component/download/decode-uri-component-0.2.0.tgz", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", "dev": true }, "deep-extend": { "version": "0.6.0", - "resolved": "http://r.tnpm.oa.com/deep-extend/download/deep-extend-0.6.0.tgz", - "integrity": "sha1-xPp8lUBKF6nD6Mp+FTcxK3NjMKw=", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", "dev": true }, "define-property": { "version": "2.0.2", - "resolved": "http://r.tnpm.oa.com/define-property/download/define-property-2.0.2.tgz", - "integrity": "sha1-1Flono1lS6d+AqgX+HENcCyxbp0=", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", "dev": true, "requires": { "is-descriptor": "^1.0.2", @@ -539,8 +545,8 @@ "dependencies": { "is-accessor-descriptor": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/is-accessor-descriptor/download/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha1-FpwvbT3x+ZJhgHI2XJsOofaHhlY=", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "dev": true, "requires": { "kind-of": "^6.0.0" @@ -548,8 +554,8 @@ }, "is-data-descriptor": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/is-data-descriptor/download/is-data-descriptor-1.0.0.tgz", - "integrity": "sha1-2Eh2Mh0Oet0DmQQGq7u9NrqSaMc=", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "dev": true, "requires": { "kind-of": "^6.0.0" @@ -557,8 +563,8 @@ }, "is-descriptor": { "version": "1.0.2", - "resolved": "http://r.tnpm.oa.com/is-descriptor/download/is-descriptor-1.0.2.tgz", - "integrity": "sha1-OxWXRqZmBLBPjIFSS6NlxfFNhuw=", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "dev": true, "requires": { "is-accessor-descriptor": "^1.0.0", @@ -569,15 +575,15 @@ } }, "diff": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", - "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true }, "dir-glob": { "version": "2.2.2", - "resolved": "http://r.tnpm.oa.com/dir-glob/download/dir-glob-2.2.2.tgz", - "integrity": "sha1-+gnwaUFTyJGLGLoN6vrpR2n8UMQ=", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.2.2.tgz", + "integrity": "sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==", "dev": true, "requires": { "path-type": "^3.0.0" @@ -585,8 +591,8 @@ }, "dot-prop": { "version": "4.2.0", - "resolved": "http://r.tnpm.oa.com/dot-prop/download/dot-prop-4.2.0.tgz", - "integrity": "sha1-HxngwuGqDjJ5fEl5nyg3rGr2nFc=", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", + "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", "dev": true, "requires": { "is-obj": "^1.0.0" @@ -594,14 +600,14 @@ }, "duplexer3": { "version": "0.1.4", - "resolved": "http://r.tnpm.oa.com/duplexer3/download/duplexer3-0.1.4.tgz", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", "dev": true }, "error-ex": { "version": "1.3.2", - "resolved": "http://r.tnpm.oa.com/error-ex/download/error-ex-1.3.2.tgz", - "integrity": "sha1-tKxAZIEH/c3PriQvQovqihTU8b8=", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", "dev": true, "requires": { "is-arrayish": "^0.2.1" @@ -615,8 +621,8 @@ }, "eslint-formatter-pretty": { "version": "1.3.0", - "resolved": "http://r.tnpm.oa.com/eslint-formatter-pretty/download/eslint-formatter-pretty-1.3.0.tgz", - "integrity": "sha1-mF2eQcH4R19KCQxdvS388oIdYH4=", + "resolved": "https://registry.npmjs.org/eslint-formatter-pretty/-/eslint-formatter-pretty-1.3.0.tgz", + "integrity": "sha512-5DY64Y1rYCm7cfFDHEGUn54bvCnK+wSUVF07N8oXeqUJFSd+gnYOTXbzelQ1HurESluY6gnEQPmXOIkB4Wa+gA==", "dev": true, "requires": { "ansi-escapes": "^2.0.0", @@ -632,15 +638,9 @@ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, - "esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true - }, "execa": { "version": "0.7.0", - "resolved": "http://r.tnpm.oa.com/execa/download/execa-0.7.0.tgz", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true, "requires": { @@ -655,7 +655,7 @@ }, "expand-brackets": { "version": "2.1.4", - "resolved": "http://r.tnpm.oa.com/expand-brackets/download/expand-brackets-2.1.4.tgz", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", "dev": true, "requires": { @@ -670,7 +670,7 @@ "dependencies": { "define-property": { "version": "0.2.5", - "resolved": "http://r.tnpm.oa.com/define-property/download/define-property-0.2.5.tgz", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { @@ -679,7 +679,7 @@ }, "extend-shallow": { "version": "2.0.1", - "resolved": "http://r.tnpm.oa.com/extend-shallow/download/extend-shallow-2.0.1.tgz", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { @@ -690,7 +690,7 @@ }, "extend-shallow": { "version": "3.0.2", - "resolved": "http://r.tnpm.oa.com/extend-shallow/download/extend-shallow-3.0.2.tgz", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", "dev": true, "requires": { @@ -700,8 +700,8 @@ "dependencies": { "is-extendable": { "version": "1.0.1", - "resolved": "http://r.tnpm.oa.com/is-extendable/download/is-extendable-1.0.1.tgz", - "integrity": "sha1-p0cPnkJnM9gb2B4RVSZOOjUHyrQ=", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", "dev": true, "requires": { "is-plain-object": "^2.0.4" @@ -711,8 +711,8 @@ }, "extglob": { "version": "2.0.4", - "resolved": "http://r.tnpm.oa.com/extglob/download/extglob-2.0.4.tgz", - "integrity": "sha1-rQD+TcYSqSMuhxhxHcXLWrAoVUM=", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", "dev": true, "requires": { "array-unique": "^0.3.2", @@ -727,7 +727,7 @@ "dependencies": { "define-property": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/define-property/download/define-property-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "dev": true, "requires": { @@ -736,7 +736,7 @@ }, "extend-shallow": { "version": "2.0.1", - "resolved": "http://r.tnpm.oa.com/extend-shallow/download/extend-shallow-2.0.1.tgz", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { @@ -745,8 +745,8 @@ }, "is-accessor-descriptor": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/is-accessor-descriptor/download/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha1-FpwvbT3x+ZJhgHI2XJsOofaHhlY=", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "dev": true, "requires": { "kind-of": "^6.0.0" @@ -754,8 +754,8 @@ }, "is-data-descriptor": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/is-data-descriptor/download/is-data-descriptor-1.0.0.tgz", - "integrity": "sha1-2Eh2Mh0Oet0DmQQGq7u9NrqSaMc=", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "dev": true, "requires": { "kind-of": "^6.0.0" @@ -763,8 +763,8 @@ }, "is-descriptor": { "version": "1.0.2", - "resolved": "http://r.tnpm.oa.com/is-descriptor/download/is-descriptor-1.0.2.tgz", - "integrity": "sha1-OxWXRqZmBLBPjIFSS6NlxfFNhuw=", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "dev": true, "requires": { "is-accessor-descriptor": "^1.0.0", @@ -776,8 +776,8 @@ }, "fast-glob": { "version": "2.2.7", - "resolved": "http://r.tnpm.oa.com/fast-glob/download/fast-glob-2.2.7.tgz", - "integrity": "sha1-aVOFfDr6R1//ku5gFdUtpwpM050=", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.7.tgz", + "integrity": "sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw==", "dev": true, "requires": { "@mrmlnc/readdir-enhanced": "^2.2.1", @@ -790,7 +790,7 @@ }, "fill-range": { "version": "4.0.0", - "resolved": "http://r.tnpm.oa.com/fill-range/download/fill-range-4.0.0.tgz", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", "dev": true, "requires": { @@ -802,7 +802,7 @@ "dependencies": { "extend-shallow": { "version": "2.0.1", - "resolved": "http://r.tnpm.oa.com/extend-shallow/download/extend-shallow-2.0.1.tgz", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { @@ -813,7 +813,7 @@ }, "find-up": { "version": "2.1.0", - "resolved": "http://r.tnpm.oa.com/find-up/download/find-up-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "requires": { @@ -822,13 +822,13 @@ }, "for-in": { "version": "1.0.2", - "resolved": "http://r.tnpm.oa.com/for-in/download/for-in-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", "dev": true }, "fragment-cache": { "version": "0.2.1", - "resolved": "http://r.tnpm.oa.com/fragment-cache/download/fragment-cache-0.2.1.tgz", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", "dev": true, "requires": { @@ -843,20 +843,20 @@ }, "get-stream": { "version": "3.0.0", - "resolved": "http://r.tnpm.oa.com/get-stream/download/get-stream-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "dev": true }, "get-value": { "version": "2.0.6", - "resolved": "http://r.tnpm.oa.com/get-value/download/get-value-2.0.6.tgz", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", "dev": true }, "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -869,7 +869,7 @@ }, "glob-parent": { "version": "3.1.0", - "resolved": "http://r.tnpm.oa.com/glob-parent/download/glob-parent-3.1.0.tgz", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", "dev": true, "requires": { @@ -879,7 +879,7 @@ "dependencies": { "is-glob": { "version": "3.1.0", - "resolved": "http://r.tnpm.oa.com/is-glob/download/is-glob-3.1.0.tgz", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", "dev": true, "requires": { @@ -890,13 +890,13 @@ }, "glob-to-regexp": { "version": "0.3.0", - "resolved": "http://r.tnpm.oa.com/glob-to-regexp/download/glob-to-regexp-0.3.0.tgz", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz", "integrity": "sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=", "dev": true }, "global-dirs": { "version": "0.1.1", - "resolved": "http://r.tnpm.oa.com/global-dirs/download/global-dirs-0.1.1.tgz", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", "integrity": "sha1-sxnA3UYH81PzvpzKTHL8FIxJ9EU=", "dev": true, "requires": { @@ -905,8 +905,8 @@ }, "globby": { "version": "9.2.0", - "resolved": "http://r.tnpm.oa.com/globby/download/globby-9.2.0.tgz", - "integrity": "sha1-/QKacGxwPSm90XD0tts6P3p8tj0=", + "resolved": "https://registry.npmjs.org/globby/-/globby-9.2.0.tgz", + "integrity": "sha512-ollPHROa5mcxDEkwg6bPt3QbEf4pDQSNtd6JPL1YvOvAo/7/0VAm9TccUeoTmarjPw4pfUthSCqcyfNB1I3ZSg==", "dev": true, "requires": { "@types/glob": "^7.1.1", @@ -921,7 +921,7 @@ }, "got": { "version": "6.7.1", - "resolved": "http://r.tnpm.oa.com/got/download/got-6.7.1.tgz", + "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", "dev": true, "requires": { @@ -940,8 +940,8 @@ }, "graceful-fs": { "version": "4.2.3", - "resolved": "http://r.tnpm.oa.com/graceful-fs/download/graceful-fs-4.2.3.tgz", - "integrity": "sha1-ShL/G2A3bvCYYsIJPt2Qgyi+hCM=", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", "dev": true }, "has-flag": { @@ -952,7 +952,7 @@ }, "has-value": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/has-value/download/has-value-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", "dev": true, "requires": { @@ -963,7 +963,7 @@ }, "has-values": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/has-values/download/has-values-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", "dev": true, "requires": { @@ -973,7 +973,7 @@ "dependencies": { "kind-of": { "version": "4.0.0", - "resolved": "http://r.tnpm.oa.com/kind-of/download/kind-of-4.0.0.tgz", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", "dev": true, "requires": { @@ -983,32 +983,32 @@ } }, "hosted-git-info": { - "version": "2.8.5", - "resolved": "http://r.tnpm.oa.com/hosted-git-info/download/hosted-git-info-2.8.5.tgz", - "integrity": "sha1-dZz88sTRVq3lmwst+r3cQqa5xww=", + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", + "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", "dev": true }, "ignore": { "version": "4.0.6", - "resolved": "http://r.tnpm.oa.com/ignore/download/ignore-4.0.6.tgz", - "integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true }, "import-lazy": { "version": "2.1.0", - "resolved": "http://r.tnpm.oa.com/import-lazy/download/import-lazy-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", "dev": true }, "imurmurhash": { "version": "0.1.4", - "resolved": "http://r.tnpm.oa.com/imurmurhash/download/imurmurhash-0.1.4.tgz", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, "indent-string": { "version": "3.2.0", - "resolved": "http://r.tnpm.oa.com/indent-string/download/indent-string-3.2.0.tgz", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", "dev": true }, @@ -1030,19 +1030,19 @@ }, "ini": { "version": "1.3.5", - "resolved": "http://r.tnpm.oa.com/ini/download/ini-1.3.5.tgz", - "integrity": "sha1-7uJfVtscnsYIXgwid4CD9Zar+Sc=", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true }, "irregular-plurals": { "version": "1.4.0", - "resolved": "http://r.tnpm.oa.com/irregular-plurals/download/irregular-plurals-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-1.4.0.tgz", "integrity": "sha1-LKmwM2UREYVUEvFr5dd8YqRYp2Y=", "dev": true }, "is-accessor-descriptor": { "version": "0.1.6", - "resolved": "http://r.tnpm.oa.com/is-accessor-descriptor/download/is-accessor-descriptor-0.1.6.tgz", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { @@ -1051,7 +1051,7 @@ "dependencies": { "kind-of": { "version": "3.2.2", - "resolved": "http://r.tnpm.oa.com/kind-of/download/kind-of-3.2.2.tgz", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { @@ -1062,20 +1062,20 @@ }, "is-arrayish": { "version": "0.2.1", - "resolved": "http://r.tnpm.oa.com/is-arrayish/download/is-arrayish-0.2.1.tgz", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, "is-buffer": { "version": "1.1.6", - "resolved": "http://r.tnpm.oa.com/is-buffer/download/is-buffer-1.1.6.tgz", - "integrity": "sha1-76ouqdqg16suoTqXsritUf776L4=", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "dev": true }, "is-ci": { "version": "1.2.1", - "resolved": "http://r.tnpm.oa.com/is-ci/download/is-ci-1.2.1.tgz", - "integrity": "sha1-43ecjuF/zPQoSI9uKBGH8uYyhBw=", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.2.1.tgz", + "integrity": "sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg==", "dev": true, "requires": { "ci-info": "^1.5.0" @@ -1083,7 +1083,7 @@ }, "is-data-descriptor": { "version": "0.1.4", - "resolved": "http://r.tnpm.oa.com/is-data-descriptor/download/is-data-descriptor-0.1.4.tgz", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { @@ -1092,7 +1092,7 @@ "dependencies": { "kind-of": { "version": "3.2.2", - "resolved": "http://r.tnpm.oa.com/kind-of/download/kind-of-3.2.2.tgz", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { @@ -1103,8 +1103,8 @@ }, "is-descriptor": { "version": "0.1.6", - "resolved": "http://r.tnpm.oa.com/is-descriptor/download/is-descriptor-0.1.6.tgz", - "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", "dev": true, "requires": { "is-accessor-descriptor": "^0.1.6", @@ -1114,34 +1114,34 @@ "dependencies": { "kind-of": { "version": "5.1.0", - "resolved": "http://r.tnpm.oa.com/kind-of/download/kind-of-5.1.0.tgz", - "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", "dev": true } } }, "is-extendable": { "version": "0.1.1", - "resolved": "http://r.tnpm.oa.com/is-extendable/download/is-extendable-0.1.1.tgz", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", "dev": true }, "is-extglob": { "version": "2.1.1", - "resolved": "http://r.tnpm.oa.com/is-extglob/download/is-extglob-2.1.1.tgz", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true }, "is-fullwidth-code-point": { "version": "2.0.0", - "resolved": "http://r.tnpm.oa.com/is-fullwidth-code-point/download/is-fullwidth-code-point-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, "is-glob": { "version": "4.0.1", - "resolved": "http://r.tnpm.oa.com/is-glob/download/is-glob-4.0.1.tgz", - "integrity": "sha1-dWfb6fL14kZ7x3q4PEopSCQHpdw=", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", "dev": true, "requires": { "is-extglob": "^2.1.1" @@ -1149,7 +1149,7 @@ }, "is-installed-globally": { "version": "0.1.0", - "resolved": "http://r.tnpm.oa.com/is-installed-globally/download/is-installed-globally-0.1.0.tgz", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.1.0.tgz", "integrity": "sha1-Df2Y9akRFxbdU13aZJL2e/PSWoA=", "dev": true, "requires": { @@ -1159,13 +1159,13 @@ }, "is-npm": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/is-npm/download/is-npm-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", "integrity": "sha1-8vtjpl5JBbQGyGBydloaTceTufQ=", "dev": true }, "is-number": { "version": "3.0.0", - "resolved": "http://r.tnpm.oa.com/is-number/download/is-number-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "dev": true, "requires": { @@ -1174,7 +1174,7 @@ "dependencies": { "kind-of": { "version": "3.2.2", - "resolved": "http://r.tnpm.oa.com/kind-of/download/kind-of-3.2.2.tgz", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { @@ -1185,13 +1185,13 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "http://r.tnpm.oa.com/is-obj/download/is-obj-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", "dev": true }, "is-path-inside": { "version": "1.0.1", - "resolved": "http://r.tnpm.oa.com/is-path-inside/download/is-path-inside-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", "dev": true, "requires": { @@ -1200,14 +1200,14 @@ }, "is-plain-obj": { "version": "1.1.0", - "resolved": "http://r.tnpm.oa.com/is-plain-obj/download/is-plain-obj-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", "dev": true }, "is-plain-object": { "version": "2.0.4", - "resolved": "http://r.tnpm.oa.com/is-plain-object/download/is-plain-object-2.0.4.tgz", - "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, "requires": { "isobject": "^3.0.1" @@ -1215,43 +1215,43 @@ }, "is-redirect": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/is-redirect/download/is-redirect-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz", "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", "dev": true }, "is-retry-allowed": { "version": "1.2.0", - "resolved": "http://r.tnpm.oa.com/is-retry-allowed/download/is-retry-allowed-1.2.0.tgz", - "integrity": "sha1-13hIi9CkZmo76KFIK58rqv7eqLQ=", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz", + "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==", "dev": true }, "is-stream": { "version": "1.1.0", - "resolved": "http://r.tnpm.oa.com/is-stream/download/is-stream-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, "is-windows": { "version": "1.0.2", - "resolved": "http://r.tnpm.oa.com/is-windows/download/is-windows-1.0.2.tgz", - "integrity": "sha1-0YUOuXkezRjmGCzhKjDzlmNLsZ0=", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", "dev": true }, "isarray": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/isarray/download/isarray-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true }, "isexe": { "version": "2.0.0", - "resolved": "http://r.tnpm.oa.com/isexe/download/isexe-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, "isobject": { "version": "3.0.1", - "resolved": "http://r.tnpm.oa.com/isobject/download/isobject-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", "dev": true }, @@ -1273,19 +1273,19 @@ }, "json-parse-better-errors": { "version": "1.0.2", - "resolved": "http://r.tnpm.oa.com/json-parse-better-errors/download/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha1-u4Z8+zRQ5pEHwTHRxRS6s9yLyqk=", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", "dev": true }, "kind-of": { - "version": "6.0.2", - "resolved": "http://r.tnpm.oa.com/kind-of/download/kind-of-6.0.2.tgz", - "integrity": "sha1-ARRrNqYhjmTljzqNZt5df8b20FE=", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true }, "latest-version": { "version": "3.1.0", - "resolved": "http://r.tnpm.oa.com/latest-version/download/latest-version-3.1.0.tgz", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-3.1.0.tgz", "integrity": "sha1-ogU4P+oyKzO1rjsYq+4NwvNW7hU=", "dev": true, "requires": { @@ -1294,7 +1294,7 @@ }, "load-json-file": { "version": "4.0.0", - "resolved": "http://r.tnpm.oa.com/load-json-file/download/load-json-file-4.0.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", "dev": true, "requires": { @@ -1306,7 +1306,7 @@ "dependencies": { "pify": { "version": "3.0.0", - "resolved": "http://r.tnpm.oa.com/pify/download/pify-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", "dev": true } @@ -1314,7 +1314,7 @@ }, "locate-path": { "version": "2.0.0", - "resolved": "http://r.tnpm.oa.com/locate-path/download/locate-path-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", "dev": true, "requires": { @@ -1324,8 +1324,8 @@ }, "log-symbols": { "version": "2.2.0", - "resolved": "http://r.tnpm.oa.com/log-symbols/download/log-symbols-2.2.0.tgz", - "integrity": "sha1-V0Dhxdbw39pK2TI7UzIQfva0xAo=", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", + "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", "dev": true, "requires": { "chalk": "^2.0.1" @@ -1333,7 +1333,7 @@ }, "loud-rejection": { "version": "1.6.0", - "resolved": "http://r.tnpm.oa.com/loud-rejection/download/loud-rejection-1.6.0.tgz", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", "dev": true, "requires": { @@ -1343,14 +1343,14 @@ }, "lowercase-keys": { "version": "1.0.1", - "resolved": "http://r.tnpm.oa.com/lowercase-keys/download/lowercase-keys-1.0.1.tgz", - "integrity": "sha1-b54wtHCE2XGnyCD/FabFFnt0wm8=", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", "dev": true }, "lru-cache": { "version": "4.1.5", - "resolved": "http://r.tnpm.oa.com/lru-cache/download/lru-cache-4.1.5.tgz", - "integrity": "sha1-i75Q6oW+1ZvJ4z3KuCNe6bz0Q80=", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", "dev": true, "requires": { "pseudomap": "^1.0.2", @@ -1359,8 +1359,8 @@ }, "make-dir": { "version": "1.3.0", - "resolved": "http://r.tnpm.oa.com/make-dir/download/make-dir-1.3.0.tgz", - "integrity": "sha1-ecEDO4BRW9bSTsmTPoYMp17ifww=", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", "dev": true, "requires": { "pify": "^3.0.0" @@ -1368,7 +1368,7 @@ "dependencies": { "pify": { "version": "3.0.0", - "resolved": "http://r.tnpm.oa.com/pify/download/pify-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", "dev": true } @@ -1376,19 +1376,19 @@ }, "map-cache": { "version": "0.2.2", - "resolved": "http://r.tnpm.oa.com/map-cache/download/map-cache-0.2.2.tgz", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", "dev": true }, "map-obj": { "version": "2.0.0", - "resolved": "http://r.tnpm.oa.com/map-obj/download/map-obj-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", "dev": true }, "map-visit": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/map-visit/download/map-visit-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", "dev": true, "requires": { @@ -1397,8 +1397,8 @@ }, "meow": { "version": "5.0.0", - "resolved": "http://r.tnpm.oa.com/meow/download/meow-5.0.0.tgz", - "integrity": "sha1-38c9Y6mvxxSl43F2DrXIi5EHiqQ=", + "resolved": "https://registry.npmjs.org/meow/-/meow-5.0.0.tgz", + "integrity": "sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig==", "dev": true, "requires": { "camelcase-keys": "^4.0.0", @@ -1414,7 +1414,7 @@ "dependencies": { "read-pkg-up": { "version": "3.0.0", - "resolved": "http://r.tnpm.oa.com/read-pkg-up/download/read-pkg-up-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", "dev": true, "requires": { @@ -1426,14 +1426,14 @@ }, "merge2": { "version": "1.3.0", - "resolved": "http://r.tnpm.oa.com/merge2/download/merge2-1.3.0.tgz", - "integrity": "sha1-WzZu6DsvFYLEj4fkfPGpNSEDyoE=", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.3.0.tgz", + "integrity": "sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw==", "dev": true }, "micromatch": { "version": "3.1.10", - "resolved": "http://r.tnpm.oa.com/micromatch/download/micromatch-3.1.10.tgz", - "integrity": "sha1-cIWbyVyYQJUvNZoGij/En57PrCM=", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", "dev": true, "requires": { "arr-diff": "^4.0.0", @@ -1461,15 +1461,15 @@ } }, "minimist": { - "version": "1.2.0", - "resolved": "http://r.tnpm.oa.com/minimist/download/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "dev": true }, "minimist-options": { "version": "3.0.2", - "resolved": "http://r.tnpm.oa.com/minimist-options/download/minimist-options-3.0.2.tgz", - "integrity": "sha1-+6TIGRM54T7PTWG+sD8HAQPz2VQ=", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-3.0.2.tgz", + "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", "dev": true, "requires": { "arrify": "^1.0.1", @@ -1478,8 +1478,8 @@ }, "mixin-deep": { "version": "1.3.2", - "resolved": "http://r.tnpm.oa.com/mixin-deep/download/mixin-deep-1.3.2.tgz", - "integrity": "sha1-ESC0PcNZp4Xc5ltVuC4lfM9HlWY=", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", "dev": true, "requires": { "for-in": "^1.0.2", @@ -1488,8 +1488,8 @@ "dependencies": { "is-extendable": { "version": "1.0.1", - "resolved": "http://r.tnpm.oa.com/is-extendable/download/is-extendable-1.0.1.tgz", - "integrity": "sha1-p0cPnkJnM9gb2B4RVSZOOjUHyrQ=", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", "dev": true, "requires": { "is-plain-object": "^2.0.4" @@ -1498,32 +1498,24 @@ } }, "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", "dev": true, "requires": { - "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - } + "minimist": "^1.2.5" } }, "ms": { "version": "2.0.0", - "resolved": "http://r.tnpm.oa.com/ms/download/ms-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, "nanomatch": { "version": "1.2.13", - "resolved": "http://r.tnpm.oa.com/nanomatch/download/nanomatch-1.2.13.tgz", - "integrity": "sha1-uHqKpPwN6P5r6IiVs4mD/yZb0Rk=", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", "dev": true, "requires": { "arr-diff": "^4.0.0", @@ -1541,8 +1533,8 @@ }, "normalize-package-data": { "version": "2.5.0", - "resolved": "http://r.tnpm.oa.com/normalize-package-data/download/normalize-package-data-2.5.0.tgz", - "integrity": "sha1-5m2xg4sgDB38IzIl0SyzZSDiNKg=", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", "dev": true, "requires": { "hosted-git-info": "^2.1.4", @@ -1553,7 +1545,7 @@ }, "npm-run-path": { "version": "2.0.2", - "resolved": "http://r.tnpm.oa.com/npm-run-path/download/npm-run-path-2.0.2.tgz", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "dev": true, "requires": { @@ -1562,7 +1554,7 @@ }, "object-copy": { "version": "0.1.0", - "resolved": "http://r.tnpm.oa.com/object-copy/download/object-copy-0.1.0.tgz", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", "dev": true, "requires": { @@ -1573,7 +1565,7 @@ "dependencies": { "define-property": { "version": "0.2.5", - "resolved": "http://r.tnpm.oa.com/define-property/download/define-property-0.2.5.tgz", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { @@ -1582,7 +1574,7 @@ }, "kind-of": { "version": "3.2.2", - "resolved": "http://r.tnpm.oa.com/kind-of/download/kind-of-3.2.2.tgz", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { @@ -1593,7 +1585,7 @@ }, "object-visit": { "version": "1.0.1", - "resolved": "http://r.tnpm.oa.com/object-visit/download/object-visit-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", "dev": true, "requires": { @@ -1602,7 +1594,7 @@ }, "object.pick": { "version": "1.3.0", - "resolved": "http://r.tnpm.oa.com/object.pick/download/object.pick-1.3.0.tgz", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", "dev": true, "requires": { @@ -1620,14 +1612,14 @@ }, "p-finally": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/p-finally/download/p-finally-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "dev": true }, "p-limit": { "version": "1.3.0", - "resolved": "http://r.tnpm.oa.com/p-limit/download/p-limit-1.3.0.tgz", - "integrity": "sha1-uGvV8MJWkJEcdZD8v8IBDVSzzLg=", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", "dev": true, "requires": { "p-try": "^1.0.0" @@ -1635,7 +1627,7 @@ }, "p-locate": { "version": "2.0.0", - "resolved": "http://r.tnpm.oa.com/p-locate/download/p-locate-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "dev": true, "requires": { @@ -1644,13 +1636,13 @@ }, "p-try": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/p-try/download/p-try-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", "dev": true }, "package-json": { "version": "4.0.1", - "resolved": "http://r.tnpm.oa.com/package-json/download/package-json-4.0.1.tgz", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-4.0.1.tgz", "integrity": "sha1-iGmgQBJTZhxMTKPabCEh7VVfXu0=", "dev": true, "requires": { @@ -1662,7 +1654,7 @@ }, "parse-json": { "version": "4.0.0", - "resolved": "http://r.tnpm.oa.com/parse-json/download/parse-json-4.0.0.tgz", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", "dev": true, "requires": { @@ -1672,19 +1664,19 @@ }, "pascalcase": { "version": "0.1.1", - "resolved": "http://r.tnpm.oa.com/pascalcase/download/pascalcase-0.1.1.tgz", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", "dev": true }, "path-dirname": { "version": "1.0.2", - "resolved": "http://r.tnpm.oa.com/path-dirname/download/path-dirname-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", "dev": true }, "path-exists": { "version": "3.0.0", - "resolved": "http://r.tnpm.oa.com/path-exists/download/path-exists-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", "dev": true }, @@ -1696,13 +1688,13 @@ }, "path-is-inside": { "version": "1.0.2", - "resolved": "http://r.tnpm.oa.com/path-is-inside/download/path-is-inside-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", "dev": true }, "path-key": { "version": "2.0.1", - "resolved": "http://r.tnpm.oa.com/path-key/download/path-key-2.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", "dev": true }, @@ -1714,8 +1706,8 @@ }, "path-type": { "version": "3.0.0", - "resolved": "http://r.tnpm.oa.com/path-type/download/path-type-3.0.0.tgz", - "integrity": "sha1-zvMdyOCho7sNEFwM2Xzzv0f0428=", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", "dev": true, "requires": { "pify": "^3.0.0" @@ -1723,7 +1715,7 @@ "dependencies": { "pify": { "version": "3.0.0", - "resolved": "http://r.tnpm.oa.com/pify/download/pify-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", "dev": true } @@ -1731,13 +1723,13 @@ }, "pify": { "version": "4.0.1", - "resolved": "http://r.tnpm.oa.com/pify/download/pify-4.0.1.tgz", - "integrity": "sha1-SyzSXFDVmHNcUCkiJP2MbfQeMjE=", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", "dev": true }, "plur": { "version": "2.1.2", - "resolved": "http://r.tnpm.oa.com/plur/download/plur-2.1.2.tgz", + "resolved": "https://registry.npmjs.org/plur/-/plur-2.1.2.tgz", "integrity": "sha1-dIJFLBoPUI4+NE6uwxLJHCncZVo=", "dev": true, "requires": { @@ -1746,32 +1738,32 @@ }, "posix-character-classes": { "version": "0.1.1", - "resolved": "http://r.tnpm.oa.com/posix-character-classes/download/posix-character-classes-0.1.1.tgz", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", "dev": true }, "prepend-http": { "version": "1.0.4", - "resolved": "http://r.tnpm.oa.com/prepend-http/download/prepend-http-1.0.4.tgz", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", "dev": true }, "pseudomap": { "version": "1.0.2", - "resolved": "http://r.tnpm.oa.com/pseudomap/download/pseudomap-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, "quick-lru": { "version": "1.1.0", - "resolved": "http://r.tnpm.oa.com/quick-lru/download/quick-lru-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz", "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=", "dev": true }, "rc": { "version": "1.2.8", - "resolved": "http://r.tnpm.oa.com/rc/download/rc-1.2.8.tgz", - "integrity": "sha1-zZJL9SAKB1uDwYjNa54hG3/A0+0=", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", "dev": true, "requires": { "deep-extend": "^0.6.0", @@ -1782,7 +1774,7 @@ }, "read-pkg": { "version": "3.0.0", - "resolved": "http://r.tnpm.oa.com/read-pkg/download/read-pkg-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", "dev": true, "requires": { @@ -1793,8 +1785,8 @@ }, "read-pkg-up": { "version": "4.0.0", - "resolved": "http://r.tnpm.oa.com/read-pkg-up/download/read-pkg-up-4.0.0.tgz", - "integrity": "sha1-GyIcYIi6d5lgHICPkRYcZuWPiXg=", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-4.0.0.tgz", + "integrity": "sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA==", "dev": true, "requires": { "find-up": "^3.0.0", @@ -1803,8 +1795,8 @@ "dependencies": { "find-up": { "version": "3.0.0", - "resolved": "http://r.tnpm.oa.com/find-up/download/find-up-3.0.0.tgz", - "integrity": "sha1-SRafHXmTQwZG2mHsxa41XCHJe3M=", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", "dev": true, "requires": { "locate-path": "^3.0.0" @@ -1812,8 +1804,8 @@ }, "locate-path": { "version": "3.0.0", - "resolved": "http://r.tnpm.oa.com/locate-path/download/locate-path-3.0.0.tgz", - "integrity": "sha1-2+w7OrdZdYBxtY/ln8QYca8hQA4=", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", "dev": true, "requires": { "p-locate": "^3.0.0", @@ -1821,9 +1813,9 @@ } }, "p-limit": { - "version": "2.2.1", - "resolved": "http://r.tnpm.oa.com/p-limit/download/p-limit-2.2.1.tgz", - "integrity": "sha1-qgeniMwxUck5tRMfY1cPDdIAlTc=", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, "requires": { "p-try": "^2.0.0" @@ -1831,8 +1823,8 @@ }, "p-locate": { "version": "3.0.0", - "resolved": "http://r.tnpm.oa.com/p-locate/download/p-locate-3.0.0.tgz", - "integrity": "sha1-Mi1poFwCZLJZl9n0DNiokasAZKQ=", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", "dev": true, "requires": { "p-limit": "^2.0.0" @@ -1840,15 +1832,15 @@ }, "p-try": { "version": "2.2.0", - "resolved": "http://r.tnpm.oa.com/p-try/download/p-try-2.2.0.tgz", - "integrity": "sha1-yyhoVA4xPWHeWPr741zpAE1VQOY=", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true } } }, "redent": { "version": "2.0.0", - "resolved": "http://r.tnpm.oa.com/redent/download/redent-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/redent/-/redent-2.0.0.tgz", "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", "dev": true, "requires": { @@ -1858,8 +1850,8 @@ }, "regex-not": { "version": "1.0.2", - "resolved": "http://r.tnpm.oa.com/regex-not/download/regex-not-1.0.2.tgz", - "integrity": "sha1-H07OJ+ALC2XgJHpoEOaoXYOldSw=", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", "dev": true, "requires": { "extend-shallow": "^3.0.2", @@ -1868,8 +1860,8 @@ }, "registry-auth-token": { "version": "3.4.0", - "resolved": "http://r.tnpm.oa.com/registry-auth-token/download/registry-auth-token-3.4.0.tgz", - "integrity": "sha1-10RoFUM/XV7WQxzV3KIQSPZrOX4=", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.4.0.tgz", + "integrity": "sha512-4LM6Fw8eBQdwMYcES4yTnn2TqIasbXuwDx3um+QRs7S55aMKCBKBxvPXl2RiUjHwuJLTyYfxSpmfSAjQpcuP+A==", "dev": true, "requires": { "rc": "^1.1.6", @@ -1878,7 +1870,7 @@ }, "registry-url": { "version": "3.1.0", - "resolved": "http://r.tnpm.oa.com/registry-url/download/registry-url-3.1.0.tgz", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz", "integrity": "sha1-PU74cPc93h138M+aOBQyRE4XSUI=", "dev": true, "requires": { @@ -1887,20 +1879,20 @@ }, "repeat-element": { "version": "1.1.3", - "resolved": "http://r.tnpm.oa.com/repeat-element/download/repeat-element-1.1.3.tgz", - "integrity": "sha1-eC4NglwMWjuzlzH4Tv7mt0Lmsc4=", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", "dev": true }, "repeat-string": { "version": "1.6.1", - "resolved": "http://r.tnpm.oa.com/repeat-string/download/repeat-string-1.6.1.tgz", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", "dev": true }, "resolve": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", - "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.16.1.tgz", + "integrity": "sha512-rmAglCSqWWMrrBv/XM6sW0NuRFiKViw/W4d9EbC4pt+49H8JwHy+mcGmALTEg504AUDcLTvb1T2q3E9AnmY+ig==", "dev": true, "requires": { "path-parse": "^1.0.6" @@ -1908,25 +1900,25 @@ }, "resolve-url": { "version": "0.2.1", - "resolved": "http://r.tnpm.oa.com/resolve-url/download/resolve-url-0.2.1.tgz", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", "dev": true }, "ret": { "version": "0.1.15", - "resolved": "http://r.tnpm.oa.com/ret/download/ret-0.1.15.tgz", - "integrity": "sha1-uKSCXVvbH8P29Twrwz+BOIaBx7w=", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", "dev": true }, "safe-buffer": { "version": "5.2.0", - "resolved": "http://r.tnpm.oa.com/safe-buffer/download/safe-buffer-5.2.0.tgz", - "integrity": "sha1-t02uxJsRSPiMZLaNSbHoFcHy9Rk=", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", "dev": true }, "safe-regex": { "version": "1.1.0", - "resolved": "http://r.tnpm.oa.com/safe-regex/download/safe-regex-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "dev": true, "requires": { @@ -1941,7 +1933,7 @@ }, "semver-diff": { "version": "2.1.0", - "resolved": "http://r.tnpm.oa.com/semver-diff/download/semver-diff-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-2.1.0.tgz", "integrity": "sha1-S7uEN8jTfksM8aaP1ybsbWRdbTY=", "dev": true, "requires": { @@ -1950,8 +1942,8 @@ }, "set-value": { "version": "2.0.1", - "resolved": "http://r.tnpm.oa.com/set-value/download/set-value-2.0.1.tgz", - "integrity": "sha1-oY1AUw5vB95CKMfe/kInr4ytAFs=", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", "dev": true, "requires": { "extend-shallow": "^2.0.1", @@ -1962,7 +1954,7 @@ "dependencies": { "extend-shallow": { "version": "2.0.1", - "resolved": "http://r.tnpm.oa.com/extend-shallow/download/extend-shallow-2.0.1.tgz", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { @@ -1973,7 +1965,7 @@ }, "shebang-command": { "version": "1.2.0", - "resolved": "http://r.tnpm.oa.com/shebang-command/download/shebang-command-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "dev": true, "requires": { @@ -1982,26 +1974,26 @@ }, "shebang-regex": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/shebang-regex/download/shebang-regex-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, "signal-exit": { - "version": "3.0.2", - "resolved": "http://r.tnpm.oa.com/signal-exit/download/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", "dev": true }, "slash": { "version": "2.0.0", - "resolved": "http://r.tnpm.oa.com/slash/download/slash-2.0.0.tgz", - "integrity": "sha1-3lUoUaF1nfOo8gZTVEL17E3eq0Q=", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", "dev": true }, "snapdragon": { "version": "0.8.2", - "resolved": "http://r.tnpm.oa.com/snapdragon/download/snapdragon-0.8.2.tgz", - "integrity": "sha1-ZJIufFZbDhQgS6GqfWlkJ40lGC0=", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", "dev": true, "requires": { "base": "^0.11.1", @@ -2016,7 +2008,7 @@ "dependencies": { "define-property": { "version": "0.2.5", - "resolved": "http://r.tnpm.oa.com/define-property/download/define-property-0.2.5.tgz", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { @@ -2025,7 +2017,7 @@ }, "extend-shallow": { "version": "2.0.1", - "resolved": "http://r.tnpm.oa.com/extend-shallow/download/extend-shallow-2.0.1.tgz", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { @@ -2036,8 +2028,8 @@ }, "snapdragon-node": { "version": "2.1.1", - "resolved": "http://r.tnpm.oa.com/snapdragon-node/download/snapdragon-node-2.1.1.tgz", - "integrity": "sha1-bBdfhv8UvbByRWPo88GwIaKGhTs=", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", "dev": true, "requires": { "define-property": "^1.0.0", @@ -2047,7 +2039,7 @@ "dependencies": { "define-property": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/define-property/download/define-property-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "dev": true, "requires": { @@ -2056,8 +2048,8 @@ }, "is-accessor-descriptor": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/is-accessor-descriptor/download/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha1-FpwvbT3x+ZJhgHI2XJsOofaHhlY=", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "dev": true, "requires": { "kind-of": "^6.0.0" @@ -2065,8 +2057,8 @@ }, "is-data-descriptor": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/is-data-descriptor/download/is-data-descriptor-1.0.0.tgz", - "integrity": "sha1-2Eh2Mh0Oet0DmQQGq7u9NrqSaMc=", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "dev": true, "requires": { "kind-of": "^6.0.0" @@ -2074,8 +2066,8 @@ }, "is-descriptor": { "version": "1.0.2", - "resolved": "http://r.tnpm.oa.com/is-descriptor/download/is-descriptor-1.0.2.tgz", - "integrity": "sha1-OxWXRqZmBLBPjIFSS6NlxfFNhuw=", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "dev": true, "requires": { "is-accessor-descriptor": "^1.0.0", @@ -2087,8 +2079,8 @@ }, "snapdragon-util": { "version": "3.0.1", - "resolved": "http://r.tnpm.oa.com/snapdragon-util/download/snapdragon-util-3.0.1.tgz", - "integrity": "sha1-+VZHlIbyrNeXAGk/b3uAXkWrVuI=", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", "dev": true, "requires": { "kind-of": "^3.2.0" @@ -2096,7 +2088,7 @@ "dependencies": { "kind-of": { "version": "3.2.2", - "resolved": "http://r.tnpm.oa.com/kind-of/download/kind-of-3.2.2.tgz", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { @@ -2107,17 +2099,17 @@ }, "source-map": { "version": "0.5.7", - "resolved": "http://r.tnpm.oa.com/source-map/download/source-map-0.5.7.tgz", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "dev": true }, "source-map-resolve": { - "version": "0.5.2", - "resolved": "http://r.tnpm.oa.com/source-map-resolve/download/source-map-resolve-0.5.2.tgz", - "integrity": "sha1-cuLMNAlVQ+Q7LGKyxMENSpBU8lk=", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", + "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", "dev": true, "requires": { - "atob": "^2.1.1", + "atob": "^2.1.2", "decode-uri-component": "^0.2.0", "resolve-url": "^0.2.1", "source-map-url": "^0.4.0", @@ -2126,14 +2118,14 @@ }, "source-map-url": { "version": "0.4.0", - "resolved": "http://r.tnpm.oa.com/source-map-url/download/source-map-url-0.4.0.tgz", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", "dev": true }, "spdx-correct": { "version": "3.1.0", - "resolved": "http://r.tnpm.oa.com/spdx-correct/download/spdx-correct-3.1.0.tgz", - "integrity": "sha1-+4PlBERSaPFUsHTiGMh8ADzTHfQ=", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", + "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", "dev": true, "requires": { "spdx-expression-parse": "^3.0.0", @@ -2142,14 +2134,14 @@ }, "spdx-exceptions": { "version": "2.2.0", - "resolved": "http://r.tnpm.oa.com/spdx-exceptions/download/spdx-exceptions-2.2.0.tgz", - "integrity": "sha1-LqRQrudPKom/uUUZwH/Nb0EyKXc=", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", "dev": true }, "spdx-expression-parse": { "version": "3.0.0", - "resolved": "http://r.tnpm.oa.com/spdx-expression-parse/download/spdx-expression-parse-3.0.0.tgz", - "integrity": "sha1-meEZt6XaAOBUkcn6M4t5BII7QdA=", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", "dev": true, "requires": { "spdx-exceptions": "^2.1.0", @@ -2158,14 +2150,14 @@ }, "spdx-license-ids": { "version": "3.0.5", - "resolved": "http://r.tnpm.oa.com/spdx-license-ids/download/spdx-license-ids-3.0.5.tgz", - "integrity": "sha1-NpS1gEVnpFjTyARYQqY1hjL2JlQ=", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", + "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", "dev": true }, "split-string": { "version": "3.1.0", - "resolved": "http://r.tnpm.oa.com/split-string/download/split-string-3.1.0.tgz", - "integrity": "sha1-fLCd2jqGWFcFxks5pkZgOGguj+I=", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", "dev": true, "requires": { "extend-shallow": "^3.0.0" @@ -2179,7 +2171,7 @@ }, "static-extend": { "version": "0.1.2", - "resolved": "http://r.tnpm.oa.com/static-extend/download/static-extend-0.1.2.tgz", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", "dev": true, "requires": { @@ -2189,7 +2181,7 @@ "dependencies": { "define-property": { "version": "0.2.5", - "resolved": "http://r.tnpm.oa.com/define-property/download/define-property-0.2.5.tgz", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { @@ -2200,8 +2192,8 @@ }, "string-width": { "version": "2.1.1", - "resolved": "http://r.tnpm.oa.com/string-width/download/string-width-2.1.1.tgz", - "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { "is-fullwidth-code-point": "^2.0.0", @@ -2210,7 +2202,7 @@ }, "strip-ansi": { "version": "4.0.0", - "resolved": "http://r.tnpm.oa.com/strip-ansi/download/strip-ansi-4.0.0.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { @@ -2219,25 +2211,25 @@ }, "strip-bom": { "version": "3.0.0", - "resolved": "http://r.tnpm.oa.com/strip-bom/download/strip-bom-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", "dev": true }, "strip-eof": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/strip-eof/download/strip-eof-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, "strip-indent": { "version": "2.0.0", - "resolved": "http://r.tnpm.oa.com/strip-indent/download/strip-indent-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", "dev": true }, "strip-json-comments": { "version": "2.0.1", - "resolved": "http://r.tnpm.oa.com/strip-json-comments/download/strip-json-comments-2.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true }, @@ -2252,7 +2244,7 @@ }, "term-size": { "version": "1.2.0", - "resolved": "http://r.tnpm.oa.com/term-size/download/term-size-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", "integrity": "sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=", "dev": true, "requires": { @@ -2261,13 +2253,13 @@ }, "timed-out": { "version": "4.0.1", - "resolved": "http://r.tnpm.oa.com/timed-out/download/timed-out-4.0.1.tgz", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", "dev": true }, "to-object-path": { "version": "0.3.0", - "resolved": "http://r.tnpm.oa.com/to-object-path/download/to-object-path-0.3.0.tgz", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", "dev": true, "requires": { @@ -2276,7 +2268,7 @@ "dependencies": { "kind-of": { "version": "3.2.2", - "resolved": "http://r.tnpm.oa.com/kind-of/download/kind-of-3.2.2.tgz", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { @@ -2287,8 +2279,8 @@ }, "to-regex": { "version": "3.0.2", - "resolved": "http://r.tnpm.oa.com/to-regex/download/to-regex-3.0.2.tgz", - "integrity": "sha1-E8/dmzNlUvMLUfM6iuG0Knp1mc4=", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", "dev": true, "requires": { "define-property": "^2.0.2", @@ -2299,7 +2291,7 @@ }, "to-regex-range": { "version": "2.1.1", - "resolved": "http://r.tnpm.oa.com/to-regex-range/download/to-regex-range-2.1.1.tgz", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", "dev": true, "requires": { @@ -2309,14 +2301,14 @@ }, "trim-newlines": { "version": "2.0.0", - "resolved": "http://r.tnpm.oa.com/trim-newlines/download/trim-newlines-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz", "integrity": "sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=", "dev": true }, "tsd": { "version": "0.11.0", - "resolved": "http://r.tnpm.oa.com/tsd/download/tsd-0.11.0.tgz", - "integrity": "sha1-7ei46FhQhFt1P/9+qvaNvTZzcAs=", + "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.11.0.tgz", + "integrity": "sha512-klKMNC0KRzUIaLJG8XqkvH/9rKwYX74xpqJBN8spWjYUDojAesd6AfDCT5dray+yhLfTGkem7O3nU6i4KwzNDw==", "dev": true, "requires": { "eslint-formatter-pretty": "^1.3.0", @@ -2328,15 +2320,15 @@ } }, "tslib": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", - "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", + "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==", "dev": true }, "tslint": { - "version": "5.20.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.0.tgz", - "integrity": "sha512-2vqIvkMHbnx8acMogAERQ/IuINOq6DFqgF8/VDvhEkBqQh/x6SP0Y+OHnKth9/ZcHQSroOZwUQSN18v8KKF0/g==", + "version": "5.20.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", + "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -2364,15 +2356,15 @@ } }, "typescript": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.3.tgz", - "integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==", + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", + "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", "dev": true }, "union-value": { "version": "1.0.1", - "resolved": "http://r.tnpm.oa.com/union-value/download/union-value-1.0.1.tgz", - "integrity": "sha1-C2/nuDWuzaYcbqTU8CwUIh4QmEc=", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", + "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", "dev": true, "requires": { "arr-union": "^3.1.0", @@ -2383,7 +2375,7 @@ }, "unique-string": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/unique-string/download/unique-string-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz", "integrity": "sha1-nhBXzKhRq7kzmPizOuGHuZyuwRo=", "dev": true, "requires": { @@ -2392,7 +2384,7 @@ }, "unset-value": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/unset-value/download/unset-value-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", "dev": true, "requires": { @@ -2402,7 +2394,7 @@ "dependencies": { "has-value": { "version": "0.3.1", - "resolved": "http://r.tnpm.oa.com/has-value/download/has-value-0.3.1.tgz", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", "dev": true, "requires": { @@ -2413,7 +2405,7 @@ "dependencies": { "isobject": { "version": "2.1.0", - "resolved": "http://r.tnpm.oa.com/isobject/download/isobject-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", "dev": true, "requires": { @@ -2424,7 +2416,7 @@ }, "has-values": { "version": "0.1.4", - "resolved": "http://r.tnpm.oa.com/has-values/download/has-values-0.1.4.tgz", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", "dev": true } @@ -2432,14 +2424,14 @@ }, "unzip-response": { "version": "2.0.1", - "resolved": "http://r.tnpm.oa.com/unzip-response/download/unzip-response-2.0.1.tgz", + "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-2.0.1.tgz", "integrity": "sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c=", "dev": true }, "update-notifier": { "version": "2.5.0", - "resolved": "http://r.tnpm.oa.com/update-notifier/download/update-notifier-2.5.0.tgz", - "integrity": "sha1-0HRFk+E/Fh5AassdlAi3LK0Ir/Y=", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-2.5.0.tgz", + "integrity": "sha512-gwMdhgJHGuj/+wHJJs9e6PcCszpxR1b236igrOkUofGhqJuG+amlIKwApH1IW1WWl7ovZxsX49lMBWLxSdm5Dw==", "dev": true, "requires": { "boxen": "^1.2.1", @@ -2456,13 +2448,13 @@ }, "urix": { "version": "0.1.0", - "resolved": "http://r.tnpm.oa.com/urix/download/urix-0.1.0.tgz", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", "dev": true }, "url-parse-lax": { "version": "1.0.0", - "resolved": "http://r.tnpm.oa.com/url-parse-lax/download/url-parse-lax-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", "dev": true, "requires": { @@ -2471,14 +2463,14 @@ }, "use": { "version": "3.1.1", - "resolved": "http://r.tnpm.oa.com/use/download/use-3.1.1.tgz", - "integrity": "sha1-1QyMrHmhn7wg8pEfVuuXP04QBw8=", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", "dev": true }, "validate-npm-package-license": { "version": "3.0.4", - "resolved": "http://r.tnpm.oa.com/validate-npm-package-license/download/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha1-/JH2uce6FchX9MssXe/uw51PQQo=", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", "dev": true, "requires": { "spdx-correct": "^3.0.0", @@ -2487,8 +2479,8 @@ }, "which": { "version": "1.3.1", - "resolved": "http://r.tnpm.oa.com/which/download/which-1.3.1.tgz", - "integrity": "sha1-pFBD1U9YBTFtqNYvn1CRjT2nCwo=", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, "requires": { "isexe": "^2.0.0" @@ -2496,8 +2488,8 @@ }, "widest-line": { "version": "2.0.1", - "resolved": "http://r.tnpm.oa.com/widest-line/download/widest-line-2.0.1.tgz", - "integrity": "sha1-dDh2RzDsfvQ4HOTfgvuYpTFCo/w=", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.1.tgz", + "integrity": "sha512-Ba5m9/Fa4Xt9eb2ELXt77JxVDV8w7qQrH0zS/TWSJdLyAwQjWoOzpzj5lwVftDz6n/EOu3tNACS84v509qwnJA==", "dev": true, "requires": { "string-width": "^2.1.1" @@ -2511,8 +2503,8 @@ }, "write-file-atomic": { "version": "2.4.3", - "resolved": "http://r.tnpm.oa.com/write-file-atomic/download/write-file-atomic-2.4.3.tgz", - "integrity": "sha1-H9Lprh3z51uNjDZ0Q8aS1MqB9IE=", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz", + "integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==", "dev": true, "requires": { "graceful-fs": "^4.1.11", @@ -2522,20 +2514,20 @@ }, "xdg-basedir": { "version": "3.0.0", - "resolved": "http://r.tnpm.oa.com/xdg-basedir/download/xdg-basedir-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz", "integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=", "dev": true }, "yallist": { "version": "2.1.2", - "resolved": "http://r.tnpm.oa.com/yallist/download/yallist-2.1.2.tgz", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true }, "yargs-parser": { "version": "10.1.0", - "resolved": "http://r.tnpm.oa.com/yargs-parser/download/yargs-parser-10.1.0.tgz", - "integrity": "sha1-cgImW4n36eny5XZeD+c1qQXtuqg=", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", "dev": true, "requires": { "camelcase": "^4.1.0" diff --git a/package.json b/package.json index fe00371..528f54f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.10.3-1", + "version": "2.10.4", "description": "Type definitions for APIs of Wechat Mini Program in TypeScript", "main": "./index.d.ts", "types": "./index.d.ts", diff --git a/test/issue.test.ts b/test/issue.test.ts index a5bb48b..cd4aaf9 100644 --- a/test/issue.test.ts +++ b/test/issue.test.ts @@ -206,10 +206,13 @@ import WX = WechatMiniprogram // https://github.com/wechat-miniprogram/api-typings/issues/88 { - wx.createSelectorQuery().select('#canvas').fields({ node: true }).exec(res => { - wx.canvasToTempFilePath({ canvas: res[0].node }) - wx.canvasToTempFilePath({ canvas: res[0].node, quality: 0.5 }) - }) + wx.createSelectorQuery() + .select('#canvas') + .fields({ node: true }) + .exec(res => { + wx.canvasToTempFilePath({ canvas: res[0].node }) + wx.canvasToTempFilePath({ canvas: res[0].node, quality: 0.5 }) + }) wx.canvasToTempFilePath({ canvasId: '' }) } diff --git a/types/wx/index.d.ts b/types/wx/index.d.ts index b7a79e4..4d34b56 100644 --- a/types/wx/index.d.ts +++ b/types/wx/index.d.ts @@ -41,8 +41,8 @@ declare namespace WechatMiniprogram { > = P extends { success: any } ? void : P extends { fail: any } - ? void - : P extends { complete: any } - ? void - : Promise>[0]> + ? void + : P extends { complete: any } + ? void + : Promise>[0]> } diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index c7b7c66..e9063a6 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -283,11 +283,11 @@ declare namespace WechatMiniprogram { } interface BLEPeripheralServerCloseOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: BLEPeripheralServerCloseCompleteCallback + complete?: CloseCompleteCallback /** 接口调用失败的回调函数 */ - fail?: BLEPeripheralServerCloseFailCallback + fail?: CloseFailCallback /** 接口调用成功的回调函数 */ - success?: BLEPeripheralServerCloseSuccessCallback + success?: CloseSuccessCallback } /** 描述service的Object */ interface BLEPeripheralService { @@ -413,9 +413,9 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb } interface CameraContextStartRecordOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: CameraContextStartRecordCompleteCallback + complete?: StartRecordCompleteCallback /** 接口调用失败的回调函数 */ - fail?: CameraContextStartRecordFailCallback + fail?: StartRecordFailCallback /** 接口调用成功的回调函数 */ success?: CameraContextStartRecordSuccessCallback /** 超过30s或页面 `onHide` 时会结束录像 */ @@ -423,29 +423,29 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb } interface CameraContextStopRecordOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: CameraContextStopRecordCompleteCallback + complete?: StopRecordCompleteCallback /** 启动视频压缩,压缩效果同`chooseVideo` */ compressed?: boolean /** 接口调用失败的回调函数 */ - fail?: CameraContextStopRecordFailCallback + fail?: StopRecordFailCallback /** 接口调用成功的回调函数 */ success?: CameraContextStopRecordSuccessCallback } interface CameraFrameListenerStartOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: CameraFrameListenerStartCompleteCallback + complete?: StartCompleteCallback /** 接口调用失败的回调函数 */ - fail?: CameraFrameListenerStartFailCallback + fail?: StartFailCallback /** 接口调用成功的回调函数 */ - success?: CameraFrameListenerStartSuccessCallback + success?: StartSuccessCallback } interface CameraFrameListenerStopOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: CameraFrameListenerStopCompleteCallback + complete?: StopCompleteCallback /** 接口调用失败的回调函数 */ - fail?: CameraFrameListenerStopFailCallback + fail?: StopFailCallback /** 接口调用成功的回调函数 */ - success?: CameraFrameListenerStopSuccessCallback + success?: StopSuccessCallback } /** Canvas 实例,可通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取。 * @@ -466,7 +466,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 画布宽度 */ width: number } - /** canvas 组件的绘图上下文 */ + /** canvas 组件的绘图上下文。CanvasContext 是旧版的接口, 新版 Canvas 2D 接口与 Web 一致。 */ interface CanvasContext { /** 填充颜色。用法同 [CanvasContext.setFillStyle()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html)。 * @@ -742,22 +742,6 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 收货人姓名 */ userName: string } - interface ChooseContactOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: ChooseContactCompleteCallback - /** 接口调用失败的回调函数 */ - fail?: ChooseContactFailCallback - /** 接口调用成功的回调函数 */ - success?: ChooseContactSuccessCallback - } - interface ChooseContactSuccessCallbackOption { - /** 联系人姓名 */ - displayName: string - /** 手机号 */ - phoneNumber: string - /** 选定联系人的所有手机号(部分 Android 系统只能选联系人而不能选特定手机号) */ - phoneNumberList: string - } /** 返回选择的文件的本地临时文件对象数组 */ interface ChooseFile { /** 选择的文件名称 */ @@ -1273,31 +1257,6 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 接口调用成功的回调函数 */ success?: CopyFileSuccessCallback } - interface CreateAnimationOption { - /** 动画延迟时间,单位 ms */ - delay?: number - /** 动画持续时间,单位 ms */ - duration?: number - /** 动画的效果 - * - * 可选值: - * - 'linear': 动画从头到尾的速度是相同的; - * - 'ease': 动画以低速开始,然后加快,在结束前变慢; - * - 'ease-in': 动画以低速开始; - * - 'ease-in-out': 动画以低速开始和结束; - * - 'ease-out': 动画以低速结束; - * - 'step-start': 动画第一帧就跳至结束状态直到结束; - * - 'step-end': 动画一直保持开始状态,最后一帧跳到结束状态; */ - timingFunction?: - | 'linear' - | 'ease' - | 'ease-in' - | 'ease-in-out' - | 'ease-out' - | 'step-start' - | 'step-end' - transformOrigin?: string - } interface CreateBLEConnectionOption { /** 用于区分设备的 id */ deviceId: string @@ -1410,16 +1369,16 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb interface DownloadFileSuccessCallbackResult { /** 用户文件路径 (本地路径)。传入 filePath 时会返回,跟传入的 filePath 一致 */ filePath: string + /** 网络请求过程中一些关键时间点的耗时信息 + * + * 最低基础库: `2.10.4` */ + profile: IAnyObject /** 开发者服务器返回的 HTTP 状态码 */ statusCode: number /** 临时文件路径 (本地路径)。没传入 filePath 指定文件存储路径时会返回,下载后的文件会存储到一个临时文件 */ tempFilePath: string errMsg: string } - interface DownloadTaskOnHeadersReceivedCallbackResult { - /** 开发者服务器返回的 HTTP Response Header */ - header: IAnyObject - } interface DownloadTaskOnProgressUpdateCallbackResult { /** 下载进度百分比 */ progress: number @@ -1472,7 +1431,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 要读取的文件路径 (本地路径) */ filePath: string /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: FileSystemManagerGetFileInfoCompleteCallback + complete?: GetFileInfoCompleteCallback /** 接口调用失败的回调函数 */ fail?: FileSystemManagerGetFileInfoFailCallback /** 接口调用成功的回调函数 */ @@ -1485,9 +1444,9 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb } interface FileSystemManagerGetSavedFileListOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: FileSystemManagerGetSavedFileListCompleteCallback + complete?: GetSavedFileListCompleteCallback /** 接口调用失败的回调函数 */ - fail?: FileSystemManagerGetSavedFileListFailCallback + fail?: GetSavedFileListFailCallback /** 接口调用成功的回调函数 */ success?: FileSystemManagerGetSavedFileListSuccessCallback } @@ -1509,17 +1468,17 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 需要删除的文件路径 (本地路径) */ filePath: string /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: FileSystemManagerRemoveSavedFileCompleteCallback + complete?: RemoveSavedFileCompleteCallback /** 接口调用失败的回调函数 */ fail?: FileSystemManagerRemoveSavedFileFailCallback /** 接口调用成功的回调函数 */ - success?: FileSystemManagerRemoveSavedFileSuccessCallback + success?: RemoveSavedFileSuccessCallback } interface FileSystemManagerSaveFileOption { /** 临时存储文件路径 (本地路径) */ tempFilePath: string /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: FileSystemManagerSaveFileCompleteCallback + complete?: SaveFileCompleteCallback /** 接口调用失败的回调函数 */ fail?: FileSystemManagerSaveFileFailCallback /** 要存储的文件路径 (本地路径) */ @@ -1558,7 +1517,8 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb | 'mic' | 'camcorder' | 'voice_communication' - | 'voice_recognition'> + | 'voice_recognition' + > errMsg: string } interface GetBLEDeviceCharacteristicsOption { @@ -1810,26 +1770,6 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb * - 'fail file not exist': 指定的 filePath 找不到文件; */ errMsg: string } - interface GetGroupEnterInfoOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: GetGroupEnterInfoCompleteCallback - /** 接口调用失败的回调函数 */ - fail?: GetGroupEnterInfoFailCallback - /** 接口调用成功的回调函数 */ - success?: GetGroupEnterInfoSuccessCallback - } - interface GetGroupEnterInfoSuccessCallbackResult { - /** 敏感数据对应的云 ID,开通[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) - * - * 最低基础库: `2.7.0` */ - cloudID: string - /** 包括敏感数据在内的完整转发信息的加密数据,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */ - encryptedData: string - /** 错误信息 */ - errMsg: string - /** 加密算法的初始向量,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */ - iv: string - } interface GetHCEStateOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: GetHCEStateCompleteCallback @@ -2328,7 +2268,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 在竖屏正方向下的安全区域 * * 最低基础库: `2.7.0` */ - safeArea: GetSystemInfoSyncResultSafeAreaResult + safeArea: SafeAreaResult /** 屏幕高度,单位px * * 最低基础库: `1.1.0` */ @@ -2354,23 +2294,6 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 可使用窗口宽度,单位px */ windowWidth: number } - /** 在竖屏正方向下的安全区域 - * - * 最低基础库: `2.7.0` */ - interface GetSystemInfoSyncResultSafeAreaResult { - /** 安全区域右下角纵坐标 */ - bottom: number - /** 安全区域的高度,单位逻辑像素 */ - height: number - /** 安全区域左上角横坐标 */ - left: number - /** 安全区域右下角横坐标 */ - right: number - /** 安全区域左上角纵坐标 */ - top: number - /** 安全区域的宽度,单位逻辑像素 */ - width: number - } interface GetUserInfoOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: GetUserInfoCompleteCallback @@ -2711,26 +2634,19 @@ innerAudioContext.onError((res) => { /** 启动小程序的 query 参数 */ query: IAnyObject /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */ - referrerInfo: LaunchOptionsAppReferrerInfo + referrerInfo: ReferrerInfo /** 启动小程序的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */ scene: number /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */ shareTicket: string } - /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */ - interface LaunchOptionsAppReferrerInfo { - /** 来源小程序、公众号或 App 的 appId */ - appId: string - /** 来源小程序传过来的数据,scene=1037或1038时支持 */ - extraData: IAnyObject - } interface LivePlayerContextPauseOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: LivePlayerContextPauseCompleteCallback + complete?: PauseCompleteCallback /** 接口调用失败的回调函数 */ - fail?: LivePlayerContextPauseFailCallback + fail?: PauseFailCallback /** 接口调用成功的回调函数 */ - success?: LivePlayerContextPauseSuccessCallback + success?: PauseSuccessCallback } interface LivePlayerContextRequestFullScreenOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ @@ -2749,60 +2665,56 @@ innerAudioContext.onError((res) => { } interface LivePlayerContextResumeOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: LivePlayerContextResumeCompleteCallback + complete?: ResumeCompleteCallback /** 接口调用失败的回调函数 */ - fail?: LivePlayerContextResumeFailCallback + fail?: ResumeFailCallback /** 接口调用成功的回调函数 */ - success?: LivePlayerContextResumeSuccessCallback + success?: ResumeSuccessCallback } interface LivePlayerContextStopOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: LivePlayerContextStopCompleteCallback + complete?: StopCompleteCallback /** 接口调用失败的回调函数 */ - fail?: LivePlayerContextStopFailCallback + fail?: StopFailCallback /** 接口调用成功的回调函数 */ - success?: LivePlayerContextStopSuccessCallback + success?: StopSuccessCallback } interface LivePusherContextPauseOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: LivePusherContextPauseCompleteCallback + complete?: PauseCompleteCallback /** 接口调用失败的回调函数 */ - fail?: LivePusherContextPauseFailCallback + fail?: PauseFailCallback /** 接口调用成功的回调函数 */ - success?: LivePusherContextPauseSuccessCallback + success?: PauseSuccessCallback } interface LivePusherContextResumeOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: LivePusherContextResumeCompleteCallback + complete?: ResumeCompleteCallback /** 接口调用失败的回调函数 */ - fail?: LivePusherContextResumeFailCallback + fail?: ResumeFailCallback /** 接口调用成功的回调函数 */ - success?: LivePusherContextResumeSuccessCallback + success?: ResumeSuccessCallback } interface LivePusherContextStartOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: LivePusherContextStartCompleteCallback + complete?: StartCompleteCallback /** 接口调用失败的回调函数 */ - fail?: LivePusherContextStartFailCallback + fail?: StartFailCallback /** 接口调用成功的回调函数 */ - success?: LivePusherContextStartSuccessCallback + success?: StartSuccessCallback } interface LivePusherContextStopOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: LivePusherContextStopCompleteCallback + complete?: StopCompleteCallback /** 接口调用失败的回调函数 */ - fail?: LivePusherContextStopFailCallback + fail?: StopFailCallback /** 接口调用成功的回调函数 */ - success?: LivePusherContextStopSuccessCallback + success?: StopSuccessCallback } interface LoadFontFaceCompleteCallbackResult { /** 加载字体结果 */ status: string } - interface LoadFontFaceFailCallbackResult { - /** 加载字体结果 */ - status: string - } interface LoadFontFaceOption { /** 定义的字体名称 */ family: string @@ -2821,10 +2733,6 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: LoadFontFaceSuccessCallback } - interface LoadFontFaceSuccessCallbackResult { - /** 加载字体结果 */ - status: string - } interface LoginOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: LoginCompleteCallback @@ -2866,6 +2774,17 @@ innerAudioContext.onError((res) => { /** 经度 */ longitude: number } + /** 用来扩展(或收缩)参照节点布局区域的边界 */ + interface Margins { + /** 节点布局区域的下边界 */ + bottom?: number + /** 节点布局区域的左边界 */ + left?: number + /** 节点布局区域的右边界 */ + right?: number + /** 节点布局区域的上边界 */ + top?: number + } /** 本地临时文件列表 */ interface MediaFile { /** 视频的时间长度 */ @@ -3055,6 +2974,27 @@ innerAudioContext.onError((res) => { /** 相交检测时的时间戳 */ time: number } + interface OffAppShowCallbackResult { + /** 小程序切前台的路径 (代码包路径) */ + path: string + /** 小程序切前台的 query 参数 */ + query: IAnyObject + /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */ + referrerInfo: ReferrerInfo + /** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */ + scene: number + /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */ + shareTicket: string + } + interface OffMessageCallbackResult { + /** 收到的消息 */ + message: ArrayBuffer + /** 消息来源的结构化信息 */ + remoteInfo: RemoteInfo + } + interface OffWindowResizeCallbackResult { + size: Size + } interface OnAccelerometerChangeCallbackResult { /** X 轴 */ x: number @@ -3069,7 +3009,7 @@ innerAudioContext.onError((res) => { /** 小程序切前台的 query 参数 */ query: IAnyObject /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */ - referrerInfo: ResultReferrerInfo + referrerInfo: ReferrerInfo /** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */ scene: number /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */ @@ -3203,6 +3143,10 @@ innerAudioContext.onError((res) => { /** `messageType=2` 时,原因 */ reason: number } + interface OnHeadersReceivedCallbackResult { + /** 开发者服务器返回的 HTTP Response Header */ + header: IAnyObject + } interface OnKeyboardHeightChangeCallbackResult { /** 键盘高度 */ height: number @@ -3223,12 +3167,6 @@ innerAudioContext.onError((res) => { /** 服务的类型 */ serviceType: string } - interface OnLocalServiceResolveFailCallbackResult { - /** 服务的名称 */ - serviceName: string - /** 服务的类型 */ - serviceType: string - } interface OnLocationChangeCallbackResult { /** 位置的精确度 */ accuracy: number @@ -3279,6 +3217,10 @@ innerAudioContext.onError((res) => { * * 最低基础库: `2.0.0` */ header: IAnyObject + /** 网络请求过程中一些关键时间点的耗时信息 + * + * 最低基础库: `2.10.4` */ + profile: IAnyObject } interface OnPageNotFoundCallbackResult { /** 是否本次启动的首个页面(例如从分享等入口进来,首个页面是开发者配置的分享页面) */ @@ -3288,20 +3230,6 @@ innerAudioContext.onError((res) => { /** 打开不存在页面的 query 参数 */ query: IAnyObject } - interface OnSocketCloseCallbackResult { - /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ - code: number - /** 一个可读的字符串,表示连接被关闭的原因。 */ - reason: string - } - interface OnSocketErrorCallbackResult { - /** 错误信息 */ - errMsg: string - } - interface OnSocketMessageCallbackResult { - /** 服务器返回的消息 */ - data: string | ArrayBuffer - } interface OnSocketOpenCallbackResult { /** 连接成功的 HTTP 响应 Header * @@ -3336,6 +3264,10 @@ innerAudioContext.onError((res) => { complete?: OpenBluetoothAdapterCompleteCallback /** 接口调用失败的回调函数 */ fail?: OpenBluetoothAdapterFailCallback + /** 蓝牙模式,可作为主/从设备,仅 iOS 需要。 + * + * 最低基础库: `2.10.0` */ + mode?: string /** 接口调用成功的回调函数 */ success?: OpenBluetoothAdapterSuccessCallback } @@ -3406,12 +3338,24 @@ innerAudioContext.onError((res) => { fail?: OpenSettingFailCallback /** 接口调用成功的回调函数 */ success?: OpenSettingSuccessCallback + /** 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。 + * + * - 注意:[2.3.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为后,才可以跳转打开设置页,管理授权信息。[详情](https://developers.weixin.qq.com/community/develop/doc/000cea2305cc5047af5733de751008) + * + * 最低基础库: `2.10.3` */ + withSubscriptions?: boolean } interface OpenSettingSuccessCallbackResult { /** [AuthSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/AuthSetting.html) * * 用户授权结果 */ authSetting: AuthSetting + /** [SubscriptionsSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/SubscriptionsSetting.html) + * + * 用户订阅消息设置,接口参数`withSubscriptions`值为`true`时才会返回。 + * + * 最低基础库: `2.10.3` */ + subscriptionsSetting: SubscriptionsSetting errMsg: string } interface PageScrollToOption { @@ -3624,10 +3568,6 @@ innerAudioContext.onError((res) => { files: string[] errMsg: string } - interface RecorderManagerOnErrorCallbackResult { - /** 错误信息 */ - errMsg: string - } interface RecorderManagerStartOption { /** 指定录音的音频输入源,可通过 [wx.getAvailableAudioSources()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.getAvailableAudioSources.html) 获取当前可用的音频源 * @@ -3725,6 +3665,13 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: RedoSuccessCallback } + /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */ + interface ReferrerInfo { + /** 来源小程序、公众号或 App 的 appId */ + appId: string + /** 来源小程序传过来的数据,scene=1037或1038时支持 */ + extraData: IAnyObject + } /** 参照区域的边界 */ interface RelativeRectResult { /** 下边界 */ @@ -3736,28 +3683,6 @@ innerAudioContext.onError((res) => { /** 上边界 */ top: number } - /** 用来扩展(或收缩)参照节点布局区域的边界 */ - interface RelativeToMargins { - /** 节点布局区域的下边界 */ - bottom?: number - /** 节点布局区域的左边界 */ - left?: number - /** 节点布局区域的右边界 */ - right?: number - /** 节点布局区域的上边界 */ - top?: number - } - /** 用来扩展(或收缩)参照节点布局区域的边界 */ - interface RelativeToViewportMargins { - /** 节点布局区域的下边界 */ - bottom?: number - /** 节点布局区域的左边界 */ - left?: number - /** 节点布局区域的右边界 */ - right?: number - /** 节点布局区域的上边界 */ - top?: number - } /** 消息来源的结构化信息 */ interface RemoteInfo { /** 发送消息的 socket 的地址 */ @@ -3862,6 +3787,18 @@ innerAudioContext.onError((res) => { * - 'json': 返回的数据为 JSON,返回后会对返回的数据进行一次 JSON.parse; * - '其他': 不对返回的内容进行 JSON.parse; */ dataType?: 'json' | '其他' + /** 开启 cache + * + * 最低基础库: `2.10.4` */ + enableCache?: boolean + /** 开启 http2 + * + * 最低基础库: `2.10.4` */ + enableHttp2?: boolean + /** 开启 quic + * + * 最低基础库: `2.10.4` */ + enableQuic?: boolean /** 接口调用失败的回调函数 */ fail?: RequestFailCallback /** 设置请求的 header,header 中不能设置 Referer。 @@ -3958,21 +3895,14 @@ innerAudioContext.onError((res) => { * * 最低基础库: `1.2.0` */ header: IAnyObject + /** 网络请求过程中一些关键时间点的耗时信息 + * + * 最低基础库: `2.10.4` */ + profile: IAnyObject /** 开发者服务器返回的 HTTP 状态码 */ statusCode: number errMsg: string } - interface RequestTaskOnHeadersReceivedCallbackResult { - /** 开发者服务器返回的 HTTP Response Header */ - header: IAnyObject - } - /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */ - interface ResultReferrerInfo { - /** 来源小程序、公众号或 App 的 appId */ - appId: string - /** 来源小程序传过来的数据,scene=1037或1038时支持 */ - extraData: IAnyObject - } interface ResumeBGMOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: ResumeBGMCompleteCallback @@ -4593,13 +4523,13 @@ innerAudioContext.onError((res) => { /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ code?: number /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: SocketTaskCloseCompleteCallback + complete?: CloseCompleteCallback /** 接口调用失败的回调函数 */ - fail?: SocketTaskCloseFailCallback + fail?: CloseFailCallback /** 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于 123 字节的 UTF-8 文本(不是字符)。 */ reason?: string /** 接口调用成功的回调函数 */ - success?: SocketTaskCloseSuccessCallback + success?: CloseSuccessCallback } interface SocketTaskOnCloseCallbackResult { /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ @@ -4607,10 +4537,6 @@ innerAudioContext.onError((res) => { /** 一个可读的字符串,表示连接被关闭的原因。 */ reason: string } - interface SocketTaskOnErrorCallbackResult { - /** 错误信息 */ - errMsg: string - } interface SocketTaskOnMessageCallbackResult { /** 服务器返回的消息 */ data: string | ArrayBuffer @@ -5213,6 +5139,10 @@ innerAudioContext.onError((res) => { * * 最低基础库: `2.4.0` */ templateInfo?: UpdatableMessageFrontEndTemplateInfo + /** 群待办消息的id,通过toDoActivityId可以把多个群代办消息聚合为同一个。通过 [updatableMessage.createActivityId](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/updatable-message/updatableMessage.createActivityId.html) 接口获取。(目前仅iOS支持) + * + * 最低基础库: `2.10.4` */ + toDoActivityId?: string /** 是否使用带 shareTicket 的转发[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */ withShareTicket?: boolean } @@ -5245,10 +5175,6 @@ innerAudioContext.onError((res) => { statusCode: number errMsg: string } - interface UploadTaskOnHeadersReceivedCallbackResult { - /** 开发者服务器返回的 HTTP Response Header */ - header: IAnyObject - } interface UploadTaskOnProgressUpdateCallbackResult { /** 上传进度百分比 */ progress: number @@ -5414,7 +5340,7 @@ innerAudioContext.onError((res) => { /** 本地文件路径 (本地路径) */ filePath: string /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: WxGetFileInfoCompleteCallback + complete?: GetFileInfoCompleteCallback /** 计算文件摘要的算法 * * 可选值: @@ -5435,9 +5361,9 @@ innerAudioContext.onError((res) => { } interface WxGetSavedFileListOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: WxGetSavedFileListCompleteCallback + complete?: GetSavedFileListCompleteCallback /** 接口调用失败的回调函数 */ - fail?: WxGetSavedFileListFailCallback + fail?: GetSavedFileListFailCallback /** 接口调用成功的回调函数 */ success?: WxGetSavedFileListSuccessCallback } @@ -5459,17 +5385,17 @@ innerAudioContext.onError((res) => { /** 需要删除的文件路径 (本地路径) */ filePath: string /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: WxRemoveSavedFileCompleteCallback + complete?: RemoveSavedFileCompleteCallback /** 接口调用失败的回调函数 */ fail?: WxRemoveSavedFileFailCallback /** 接口调用成功的回调函数 */ - success?: WxRemoveSavedFileSuccessCallback + success?: RemoveSavedFileSuccessCallback } interface WxSaveFileOption { /** 需要保存的文件的临时路径 (本地路径) */ tempFilePath: string /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: WxSaveFileCompleteCallback + complete?: SaveFileCompleteCallback /** 接口调用失败的回调函数 */ fail?: WxSaveFileFailCallback /** 接口调用成功的回调函数 */ @@ -5482,20 +5408,21 @@ innerAudioContext.onError((res) => { } interface WxStartRecordOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: WxStartRecordCompleteCallback + complete?: StartRecordCompleteCallback /** 接口调用失败的回调函数 */ - fail?: WxStartRecordFailCallback + fail?: StartRecordFailCallback /** 接口调用成功的回调函数 */ success?: WxStartRecordSuccessCallback } interface WxStopRecordOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: WxStopRecordCompleteCallback + complete?: StopRecordCompleteCallback /** 接口调用失败的回调函数 */ - fail?: WxStopRecordFailCallback + fail?: StopRecordFailCallback /** 接口调用成功的回调函数 */ success?: WxStopRecordSuccessCallback } + /** 环境变量 */ interface env { /** 文件系统中的用户目录路径 (本地路径) */ USER_DATA_PATH: string @@ -5510,28 +5437,28 @@ innerAudioContext.onError((res) => { * 设置背景色 */ backgroundColor( /** 颜色值 */ - value: string, + value: string ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.bottom(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.bottom.html) * * 设置 bottom 值 */ bottom( /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */ - value: number | string, + value: number | string ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.height(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.height.html) * * 设置高度 */ height( /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */ - value: number | string, + value: number | string ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.left(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.left.html) * * 设置 left 值 */ left( /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */ - value: number | string, + value: number | string ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.matrix()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.matrix.html) * @@ -5546,21 +5473,21 @@ innerAudioContext.onError((res) => { * 设置透明度 */ opacity( /** 透明度,范围 0-1 */ - value: number, + value: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.right(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.right.html) * * 设置 right 值 */ right( /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */ - value: number | string, + value: number | string ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotate(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotate.html) * * 从原点顺时针旋转一个角度 */ rotate( /** 旋转的角度。范围 [-180, 180] */ - angle: number, + angle: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotate3d(number x, number y, number z, number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotate3d.html) * @@ -5573,28 +5500,28 @@ innerAudioContext.onError((res) => { /** 旋转轴的 z 坐标 */ z: number, /** 旋转的角度。范围 [-180, 180] */ - angle: number, + angle: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotateX(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotateX.html) * * 从 X 轴顺时针旋转一个角度 */ rotateX( /** 旋转的角度。范围 [-180, 180] */ - angle: number, + angle: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotateY(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotateY.html) * * 从 Y 轴顺时针旋转一个角度 */ rotateY( /** 旋转的角度。范围 [-180, 180] */ - angle: number, + angle: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotateZ(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotateZ.html) * * 从 Z 轴顺时针旋转一个角度 */ rotateZ( /** 旋转的角度。范围 [-180, 180] */ - angle: number, + angle: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scale(number sx, number sy)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scale.html) * @@ -5603,7 +5530,7 @@ innerAudioContext.onError((res) => { /** 当仅有 sx 参数时,表示在 X 轴、Y 轴同时缩放sx倍数 */ sx: number, /** 在 Y 轴缩放 sy 倍数 */ - sy?: number, + sy?: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scale3d(number sx, number sy, number sz)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scale3d.html) * @@ -5614,28 +5541,28 @@ innerAudioContext.onError((res) => { /** y 轴的缩放倍数 */ sy: number, /** z 轴的缩放倍数 */ - sz: number, + sz: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scaleX(number scale)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scaleX.html) * * 缩放 X 轴 */ scaleX( /** X 轴的缩放倍数 */ - scale: number, + scale: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scaleY(number scale)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scaleY.html) * * 缩放 Y 轴 */ scaleY( /** Y 轴的缩放倍数 */ - scale: number, + scale: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scaleZ(number scale)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scaleZ.html) * * 缩放 Z 轴 */ scaleZ( /** Z 轴的缩放倍数 */ - scale: number, + scale: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.skew(number ax, number ay)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.skew.html) * @@ -5644,21 +5571,21 @@ innerAudioContext.onError((res) => { /** 对 X 轴坐标倾斜的角度,范围 [-180, 180] */ ax: number, /** 对 Y 轴坐标倾斜的角度,范围 [-180, 180] */ - ay: number, + ay: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.skewX(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.skewX.html) * * 对 X 轴坐标进行倾斜 */ skewX( /** 倾斜的角度,范围 [-180, 180] */ - angle: number, + angle: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.skewY(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.skewY.html) * * 对 Y 轴坐标进行倾斜 */ skewY( /** 倾斜的角度,范围 [-180, 180] */ - angle: number, + angle: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.step(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.step.html) * @@ -5669,7 +5596,7 @@ innerAudioContext.onError((res) => { * 设置 top 值 */ top( /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */ - value: number | string, + value: number | string ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translate(number tx, number ty)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translate.html) * @@ -5678,7 +5605,7 @@ innerAudioContext.onError((res) => { /** 当仅有该参数时表示在 X 轴偏移 tx,单位 px */ tx?: number, /** 在 Y 轴平移的距离,单位为 px */ - ty?: number, + ty?: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translate3d(number tx, number ty, number tz)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translate3d.html) * @@ -5689,35 +5616,35 @@ innerAudioContext.onError((res) => { /** 在 Y 轴平移的距离,单位为 px */ ty?: number, /** 在 Z 轴平移的距离,单位为 px */ - tz?: number, + tz?: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translateX(number translation)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translateX.html) * * 对 X 轴平移 */ translateX( /** 在 X 轴平移的距离,单位为 px */ - translation: number, + translation: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translateY(number translation)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translateY.html) * * 对 Y 轴平移 */ translateY( /** 在 Y 轴平移的距离,单位为 px */ - translation: number, + translation: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translateZ(number translation)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translateZ.html) * * 对 Z 轴平移 */ translateZ( /** 在 Z 轴平移的距离,单位为 px */ - translation: number, + translation: number ): Animation /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.width(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.width.html) * * 设置宽度 */ width( /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */ - value: number | string, + value: number | string ): Animation } interface AudioContext { @@ -5734,14 +5661,14 @@ innerAudioContext.onError((res) => { * 跳转到指定位置。 */ seek( /** 跳转位置,单位 s */ - position: number, + position: number ): void /** [AudioContext.setSrc(string src)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.setSrc.html) * * 设置音频地址 */ setSrc( /** 音频地址 */ - src: string, + src: string ): void } interface BLEPeripheralServer { @@ -5764,7 +5691,7 @@ innerAudioContext.onError((res) => { * 最低基础库: `2.10.3` */ offCharacteristicReadRequest( /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ - callback: OffCharacteristicReadRequestCallback, + callback: OffCharacteristicReadRequestCallback ): void /** [BLEPeripheralServer.offCharacteristicWriteRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicWriteRequest.html) * @@ -5773,7 +5700,7 @@ innerAudioContext.onError((res) => { * 最低基础库: `2.10.3` */ offCharacteristicWriteRequest( /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */ - callback: OffCharacteristicWriteRequestCallback, + callback: OffCharacteristicWriteRequestCallback ): void /** [BLEPeripheralServer.onCharacteristicReadRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicReadRequest.html) * @@ -5782,7 +5709,7 @@ innerAudioContext.onError((res) => { * 最低基础库: `2.10.3` */ onCharacteristicReadRequest( /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ - callback: OnCharacteristicReadRequestCallback, + callback: OnCharacteristicReadRequestCallback ): void /** [BLEPeripheralServer.onCharacteristicWriteRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicWriteRequest.html) * @@ -5791,7 +5718,7 @@ innerAudioContext.onError((res) => { * 最低基础库: `2.10.3` */ onCharacteristicWriteRequest( /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */ - callback: OnCharacteristicWriteRequestCallback, + callback: OnCharacteristicWriteRequestCallback ): void /** [BLEPeripheralServer.removeService(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.removeService.html) * @@ -5844,84 +5771,84 @@ innerAudioContext.onError((res) => { * 监听背景音频进入可播放状态事件。 但不保证后面可以流畅播放 */ onCanplay( /** 背景音频进入可播放状态事件的回调函数 */ - callback: BackgroundAudioManagerOnCanplayCallback, + callback: BackgroundAudioManagerOnCanplayCallback ): void /** [BackgroundAudioManager.onEnded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onEnded.html) * * 监听背景音频自然播放结束事件 */ onEnded( /** 背景音频自然播放结束事件的回调函数 */ - callback: BackgroundAudioManagerOnEndedCallback, + callback: BackgroundAudioManagerOnEndedCallback ): void /** [BackgroundAudioManager.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onError.html) * * 监听背景音频播放错误事件 */ onError( /** 背景音频播放错误事件的回调函数 */ - callback: BackgroundAudioManagerOnErrorCallback, + callback: BackgroundAudioManagerOnErrorCallback ): void /** [BackgroundAudioManager.onNext(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onNext.html) * * 监听用户在系统音乐播放面板点击下一曲事件(仅iOS) */ onNext( /** 用户在系统音乐播放面板点击下一曲事件的回调函数 */ - callback: OnNextCallback, + callback: OnNextCallback ): void /** [BackgroundAudioManager.onPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPause.html) * * 监听背景音频暂停事件 */ onPause( /** 背景音频暂停事件的回调函数 */ - callback: BackgroundAudioManagerOnPauseCallback, + callback: BackgroundAudioManagerOnPauseCallback ): void /** [BackgroundAudioManager.onPlay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPlay.html) * * 监听背景音频播放事件 */ onPlay( /** 背景音频播放事件的回调函数 */ - callback: BackgroundAudioManagerOnPlayCallback, + callback: BackgroundAudioManagerOnPlayCallback ): void /** [BackgroundAudioManager.onPrev(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPrev.html) * * 监听用户在系统音乐播放面板点击上一曲事件(仅iOS) */ onPrev( /** 用户在系统音乐播放面板点击上一曲事件的回调函数 */ - callback: OnPrevCallback, + callback: OnPrevCallback ): void /** [BackgroundAudioManager.onSeeked(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onSeeked.html) * * 监听背景音频完成跳转操作事件 */ onSeeked( /** 背景音频完成跳转操作事件的回调函数 */ - callback: BackgroundAudioManagerOnSeekedCallback, + callback: BackgroundAudioManagerOnSeekedCallback ): void /** [BackgroundAudioManager.onSeeking(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onSeeking.html) * * 监听背景音频开始跳转操作事件 */ onSeeking( /** 背景音频开始跳转操作事件的回调函数 */ - callback: BackgroundAudioManagerOnSeekingCallback, + callback: BackgroundAudioManagerOnSeekingCallback ): void /** [BackgroundAudioManager.onStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onStop.html) * * 监听背景音频停止事件 */ onStop( /** 背景音频停止事件的回调函数 */ - callback: BackgroundAudioManagerOnStopCallback, + callback: BackgroundAudioManagerOnStopCallback ): void /** [BackgroundAudioManager.onTimeUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onTimeUpdate.html) * * 监听背景音频播放进度更新事件,只有小程序在前台时会回调。 */ onTimeUpdate( /** 背景音频播放进度更新事件的回调函数 */ - callback: BackgroundAudioManagerOnTimeUpdateCallback, + callback: BackgroundAudioManagerOnTimeUpdateCallback ): void /** [BackgroundAudioManager.onWaiting(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onWaiting.html) * * 监听音频加载中事件。当音频因为数据不足,需要停下来加载时会触发 */ onWaiting( /** 音频加载中事件的回调函数 */ - callback: BackgroundAudioManagerOnWaitingCallback, + callback: OnWaitingCallback ): void /** [BackgroundAudioManager.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.pause.html) * @@ -5936,7 +5863,7 @@ innerAudioContext.onError((res) => { * 跳转到指定位置 */ seek( /** 跳转的位置,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */ - currentTime: number, + currentTime: number ): void /** [BackgroundAudioManager.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.stop.html) * @@ -6020,7 +5947,7 @@ listener.start() * 最低基础库: `2.7.0` */ onCameraFrame( /** 回调函数 */ - callback: OnCameraFrameCallback, + callback: OnCameraFrameCallback ): CameraFrameListener } interface CameraFrameListener { @@ -6069,7 +5996,7 @@ listener.start() * 最低基础库: `2.7.0` */ requestAnimationFrame( /** 执行的 callback */ - callback: (...args: any[]) => any, + callback: (...args: any[]) => any ): number } interface CanvasContext { @@ -6150,7 +6077,7 @@ ctx.draw() /** 终止弧度 */ eAngle: number, /** 弧度的方向是否是逆时针 */ - counterclockwise?: boolean, + counterclockwise?: boolean ): void /** [CanvasContext.arcTo(number x1, number y1, number x2, number y2, number radius)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.arcTo.html) * @@ -6167,7 +6094,7 @@ ctx.draw() /** 第二个控制点的 y 轴坐标 */ y2: number, /** 圆弧的半径 */ - radius: number, + radius: number ): void /** [CanvasContext.beginPath()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.beginPath.html) * @@ -6275,7 +6202,7 @@ ctx.draw() /** 结束点的 x 坐标 */ x: number, /** 结束点的 y 坐标 */ - y: number, + y: number ): void /** [CanvasContext.clearRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.clearRect.html) * @@ -6306,7 +6233,7 @@ ctx.draw() /** 矩形路径的宽度 */ width: number, /** 矩形路径的高度 */ - height: number, + height: number ): void /** [CanvasContext.clip()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.clip.html) * @@ -6392,7 +6319,7 @@ ctx.draw() * - 'repeat-x': 水平方向重复; * - 'repeat-y': 竖直方向重复; * - 'no-repeat': 不重复; */ - repetition: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat', + repetition: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' ): void /** [CanvasContext.draw(boolean reserve, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.draw.html) * @@ -6433,7 +6360,7 @@ ctx.draw() /** 本次绘制是否接着上一次绘制。即 reserve 参数为 false,则在本次调用绘制之前 native 层会先清空画布再继续绘制;若 reserve 参数为 true,则保留当前画布上的内容,本次调用 drawCanvas 绘制的内容覆盖在上面,默认 false。 */ reserve?: boolean, /** 绘制完成后执行的回调函数 */ - callback?: (...args: any[]) => any, + callback?: (...args: any[]) => any ): void /** [CanvasContext.drawImage(string imageResource, number sx, number sy, number sWidth, number sHeight, number dx, number dy, number dWidth, number dHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html) * @@ -6467,7 +6394,7 @@ wx.chooseImage({ /** imageResource的左上角在目标 canvas 上 x 轴的位置 */ dx: number, /** imageResource的左上角在目标 canvas 上 y 轴的位置 */ - dy: number, + dy: number ): void /** [CanvasContext.drawImage(string imageResource, number sx, number sy, number sWidth, number sHeight, number dx, number dy, number dWidth, number dHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html) * @@ -6505,7 +6432,7 @@ wx.chooseImage({ /** 在目标画布上绘制imageResource的宽度,允许对绘制的imageResource进行缩放 */ dWidth: number, /** 在目标画布上绘制imageResource的高度,允许对绘制的imageResource进行缩放 */ - dHeight: number, + dHeight: number ): void /** [CanvasContext.drawImage(string imageResource, number sx, number sy, number sWidth, number sHeight, number dx, number dy, number dWidth, number dHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html) * @@ -6551,7 +6478,7 @@ wx.chooseImage({ /** 在目标画布上绘制imageResource的宽度,允许对绘制的imageResource进行缩放 */ dWidth: number, /** 在目标画布上绘制imageResource的高度,允许对绘制的imageResource进行缩放 */ - dHeight: number, + dHeight: number ): void /** [CanvasContext.fill()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fill.html) * @@ -6623,7 +6550,7 @@ ctx.draw() /** 矩形路径的宽度 */ width: number, /** 矩形路径的高度 */ - height: number, + height: number ): void /** [CanvasContext.fillText(string text, number x, number y, number maxWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fillText.html) * @@ -6650,7 +6577,7 @@ ctx.draw() /** 绘制文本的左上角 y 坐标位置 */ y: number, /** 需要绘制的最大宽度,可选 */ - maxWidth?: number, + maxWidth?: number ): void /** [CanvasContext.lineTo(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.lineTo.html) * @@ -6672,7 +6599,7 @@ ctx.draw() /** 目标位置的 x 坐标 */ x: number, /** 目标位置的 y 坐标 */ - y: number, + y: number ): void /** [CanvasContext.moveTo(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.moveTo.html) * @@ -6696,7 +6623,7 @@ ctx.draw() /** 目标位置的 x 坐标 */ x: number, /** 目标位置的 y 坐标 */ - y: number, + y: number ): void /** [CanvasContext.quadraticCurveTo(number cpx, number cpy, number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.quadraticCurveTo.html) * @@ -6760,7 +6687,7 @@ ctx.draw() /** 结束点的 x 坐标 */ x: number, /** 结束点的 y 坐标 */ - y: number, + y: number ): void /** [CanvasContext.rect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.rect.html) * @@ -6785,7 +6712,7 @@ ctx.draw() /** 矩形路径的宽度 */ width: number, /** 矩形路径的高度 */ - height: number, + height: number ): void /** [CanvasContext.restore()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.restore.html) * @@ -6831,7 +6758,7 @@ ctx.draw() * ![](@program/dev/image/canvas/rotate.png) */ rotate( /** 旋转角度,以弧度计 degrees * Math.PI/180;degrees 范围为 0-360 */ - rotate: number, + rotate: number ): void /** [CanvasContext.save()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.save.html) * @@ -6879,7 +6806,7 @@ ctx.draw() /** 横坐标缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%) */ scaleWidth: number, /** 纵坐标轴缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%) */ - scaleHeight: number, + scaleHeight: number ): void /** [CanvasContext.setFillStyle(string|[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html) * @@ -6897,7 +6824,7 @@ ctx.draw() * ![](@program/dev/image/canvas/fill-rect.png) */ setFillStyle( /** 填充的颜色,默认颜色为 black。 */ - color: string | CanvasGradient, + color: string | CanvasGradient ): void /** [CanvasContext.setFontSize(number fontSize)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFontSize.html) * @@ -6923,7 +6850,7 @@ ctx.draw() * ![](@program/dev/image/canvas/font-size.png) */ setFontSize( /** 字体的字号 */ - fontSize: number, + fontSize: number ): void /** [CanvasContext.setGlobalAlpha(number alpha)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setGlobalAlpha.html) * @@ -6948,7 +6875,7 @@ ctx.draw() * ![](@program/dev/image/canvas/global-alpha.png) */ setGlobalAlpha( /** 透明度。范围 0-1,0 表示完全透明,1 表示完全不透明。 */ - alpha: number, + alpha: number ): void /** [CanvasContext.setLineCap(string lineCap)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineCap.html) * @@ -6995,7 +6922,7 @@ ctx.draw() * - 'butt': 向线条的每个末端添加平直的边缘。; * - 'round': 向线条的每个末端添加圆形线帽。; * - 'square': 向线条的每个末端添加正方形线帽。; */ - lineCap: 'butt' | 'round' | 'square', + lineCap: 'butt' | 'round' | 'square' ): void /** [CanvasContext.setLineDash(Array.<number> pattern, number offset)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineDash.html) * @@ -7023,7 +6950,7 @@ ctx.draw() /** 一组描述交替绘制线段和间距(坐标空间单位)长度的数字 */ pattern: number[], /** 虚线偏移量 */ - offset: number, + offset: number ): void /** [CanvasContext.setLineJoin(string lineJoin)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html) * @@ -7074,7 +7001,7 @@ ctx.draw() * - 'bevel': 斜角; * - 'round': 圆角; * - 'miter': 尖角; */ - lineJoin: 'bevel' | 'round' | 'miter', + lineJoin: 'bevel' | 'round' | 'miter' ): void /** [CanvasContext.setLineWidth(number lineWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineWidth.html) * @@ -7114,7 +7041,7 @@ ctx.draw() * ![](@program/dev/image/canvas/line-width.png) */ setLineWidth( /** 线条的宽度,单位px */ - lineWidth: number, + lineWidth: number ): void /** [CanvasContext.setMiterLimit(number miterLimit)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setMiterLimit.html) * @@ -7166,7 +7093,7 @@ ctx.draw() * ![](@program/dev/image/canvas/miter-limit.png) */ setMiterLimit( /** 最大斜接长度 */ - miterLimit: number, + miterLimit: number ): void /** [CanvasContext.setShadow(number offsetX, number offsetY, number blur, string color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setShadow.html) * @@ -7191,7 +7118,7 @@ ctx.draw() /** 阴影的模糊级别,数值越大越模糊。范围 0- 100。,默认值为 0。 */ blur: number, /** 阴影的颜色。默认值为 black。 */ - color: string, + color: string ): void /** [CanvasContext.setStrokeStyle(string|[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html) * @@ -7209,7 +7136,7 @@ ctx.draw() * ![](@program/dev/image/canvas/stroke-rect.png) */ setStrokeStyle( /** 描边的颜色,默认颜色为 black。 */ - color: string | CanvasGradient, + color: string | CanvasGradient ): void /** [CanvasContext.setTextAlign(string align)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextAlign.html) * @@ -7250,7 +7177,7 @@ ctx.draw() * - 'left': 左对齐; * - 'center': 居中对齐; * - 'right': 右对齐; */ - align: 'left' | 'center' | 'right', + align: 'left' | 'center' | 'right' ): void /** [CanvasContext.setTextBaseline(string textBaseline)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextBaseline.html) * @@ -7294,7 +7221,7 @@ ctx.draw() * - 'bottom': 底部对齐; * - 'middle': 居中对齐; * - 'normal': ; */ - textBaseline: 'top' | 'bottom' | 'middle' | 'normal', + textBaseline: 'top' | 'bottom' | 'middle' | 'normal' ): void /** [CanvasContext.setTransform(number scaleX, number skewX, number skewY, number scaleY, number translateX, number translateY)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTransform.html) * @@ -7313,7 +7240,7 @@ ctx.draw() /** 水平移动 */ translateX: number, /** 垂直移动 */ - translateY: number, + translateY: number ): void /** [CanvasContext.stroke()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.stroke.html) * @@ -7381,7 +7308,7 @@ ctx.draw() /** 矩形路径的宽度 */ width: number, /** 矩形路径的高度 */ - height: number, + height: number ): void /** [CanvasContext.strokeText(string text, number x, number y, number maxWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.strokeText.html) * @@ -7396,7 +7323,7 @@ ctx.draw() /** 文本起始点的 y 轴坐标 */ y: number, /** 需要绘制的最大宽度,可选 */ - maxWidth?: number, + maxWidth?: number ): void /** [CanvasContext.transform(number scaleX, number skewX, number skewY, number scaleY, number translateX, number translateY)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.transform.html) * @@ -7415,7 +7342,7 @@ ctx.draw() /** 水平移动 */ translateX: number, /** 垂直移动 */ - translateY: number, + translateY: number ): void /** [CanvasContext.translate(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.translate.html) * @@ -7442,7 +7369,7 @@ ctx.draw() /** 水平坐标平移量 */ x: number, /** 竖直坐标平移量 */ - y: number, + y: number ): void /** [Object CanvasContext.measureText(string text)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.measureText.html) * @@ -7451,7 +7378,7 @@ ctx.draw() * 最低基础库: `1.9.90` */ measureText( /** 要测量的文本 */ - text: string, + text: string ): TextMetrics /** [[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) CanvasContext.createCircularGradient(number x, number y, number r)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createCircularGradient.html) * @@ -7480,7 +7407,7 @@ ctx.draw() /** 圆心的 y 坐标 */ y: number, /** 圆的半径 */ - r: number, + r: number ): CanvasGradient /** [[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) CanvasContext.createLinearGradient(number x0, number y0, number x1, number y1)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createLinearGradient.html) * @@ -7511,7 +7438,7 @@ ctx.draw() /** 终点的 x 坐标 */ x1: number, /** 终点的 y 坐标 */ - y1: number, + y1: number ): CanvasGradient } interface CanvasGradient { @@ -7545,7 +7472,7 @@ ctx.draw() /** 表示渐变中开始与结束之间的位置,范围 0-1。 */ stop: number, /** 渐变点的颜色。 */ - color: string, + color: string ): void } interface Console { @@ -7573,7 +7500,7 @@ ctx.draw() * 仅在工具中有效,在 vConsole 中为空函数实现。 */ group( /** 分组标记,可选。 */ - label?: string, + label?: string ): void /** [console.groupEnd()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.groupEnd.html) * @@ -7620,7 +7547,7 @@ ctx.draw() * 最低基础库: `2.1.0` */ offHeadersReceived( /** HTTP Response Header 事件的回调函数 */ - callback: DownloadTaskOffHeadersReceivedCallback, + callback: DownloadTaskOffHeadersReceivedCallback ): void /** [DownloadTask.offProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offProgressUpdate.html) * @@ -7629,7 +7556,7 @@ ctx.draw() * 最低基础库: `2.1.0` */ offProgressUpdate( /** 下载进度变化事件的回调函数 */ - callback: DownloadTaskOffProgressUpdateCallback, + callback: DownloadTaskOffProgressUpdateCallback ): void /** [DownloadTask.onHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onHeadersReceived.html) * @@ -7638,7 +7565,7 @@ ctx.draw() * 最低基础库: `2.1.0` */ onHeadersReceived( /** HTTP Response Header 事件的回调函数 */ - callback: DownloadTaskOnHeadersReceivedCallback, + callback: DownloadTaskOnHeadersReceivedCallback ): void /** [DownloadTask.onProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onProgressUpdate.html) * @@ -7647,7 +7574,7 @@ ctx.draw() * 最低基础库: `1.4.0` */ onProgressUpdate( /** 下载进度变化事件的回调函数 */ - callback: DownloadTaskOnProgressUpdateCallback, + callback: DownloadTaskOnProgressUpdateCallback ): void } interface EditorContext { @@ -7703,7 +7630,7 @@ ctx.draw() /** 属性 */ name: string, /** 值 */ - value?: string, + value?: string ): void /** [EditorContext.getContents(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getContents.html) * @@ -7803,7 +7730,7 @@ this.editorCtx.insertImage({ /** 事件名称 */ eventName: string, /** 事件监听函数 */ - fn: EventCallback, + fn: EventCallback ): void /** [EventChannel.on(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.on.html) * @@ -7814,7 +7741,7 @@ this.editorCtx.insertImage({ /** 事件名称 */ eventName: string, /** 事件监听函数 */ - fn: EventCallback, + fn: EventCallback ): void /** [EventChannel.once(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.once.html) * @@ -7825,7 +7752,7 @@ this.editorCtx.insertImage({ /** 事件名称 */ eventName: string, /** 事件监听函数 */ - fn: EventCallback, + fn: EventCallback ): void } interface FileSystemManager { @@ -7834,7 +7761,7 @@ this.editorCtx.insertImage({ * [FileSystemManager.readdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdir.html) 的同步版本 */ readdirSync( /** 要读取的目录路径 (本地路径) */ - dirPath: string, + dirPath: string ): string[] /** [FileSystemManager.access(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html) * @@ -7845,7 +7772,7 @@ this.editorCtx.insertImage({ * [FileSystemManager.access](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html) 的同步版本 */ accessSync( /** 要判断是否存在的文件/目录路径 (本地路径) */ - path: string, + path: string ): void /** [FileSystemManager.appendFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFile.html) * @@ -7888,7 +7815,7 @@ this.editorCtx.insertImage({ | 'utf-16le' | 'utf-8' | 'utf8' - | 'latin1', + | 'latin1' ): void /** [FileSystemManager.copyFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html) * @@ -7901,7 +7828,7 @@ this.editorCtx.insertImage({ /** 源文件路径,支持本地路径 */ srcPath: string, /** 目标文件路径,支持本地路径 */ - destPath: string, + destPath: string ): void /** [FileSystemManager.getFileInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.getFileInfo.html) * @@ -7924,7 +7851,7 @@ this.editorCtx.insertImage({ /** 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。 * * 最低基础库: `2.3.0` */ - recursive?: boolean, + recursive?: boolean ): void /** [FileSystemManager.readFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html) * @@ -7949,7 +7876,7 @@ this.editorCtx.insertImage({ /** 源文件路径,支持本地路径 */ oldPath: string, /** 新文件路径,支持本地路径 */ - newPath: string, + newPath: string ): void /** [FileSystemManager.rmdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdir.html) * @@ -7964,7 +7891,7 @@ this.editorCtx.insertImage({ /** 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。 * * 最低基础库: `2.3.0` */ - recursive?: boolean, + recursive?: boolean ): void /** [FileSystemManager.saveFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFile.html) * @@ -7983,7 +7910,7 @@ this.editorCtx.insertImage({ * [FileSystemManager.unlink](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlink.html) 的同步版本 */ unlinkSync( /** 要删除的文件路径 (本地路径) */ - filePath: string, + filePath: string ): void /** [FileSystemManager.unzip(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unzip.html) * @@ -8026,7 +7953,7 @@ this.editorCtx.insertImage({ | 'utf-16le' | 'utf-8' | 'utf8' - | 'latin1', + | 'latin1' ): void /** [[Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)|Object FileSystemManager.statSync(string path, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.statSync.html) * @@ -8037,7 +7964,7 @@ this.editorCtx.insertImage({ /** 是否递归获取目录下的每个文件的 Stats 信息 * * 最低基础库: `2.3.0` */ - recursive?: boolean, + recursive?: boolean ): Stats | IAnyObject /** [string FileSystemManager.saveFileSync(string tempFilePath, string filePath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFileSync.html) * @@ -8046,7 +7973,7 @@ this.editorCtx.insertImage({ /** 临时存储文件路径 (本地路径) */ tempFilePath: string, /** 要存储的文件路径 (本地路径) */ - filePath?: string, + filePath?: string ): string /** [string|ArrayBuffer FileSystemManager.readFileSync(string filePath, string encoding, string position, string length)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFileSync.html) * @@ -8087,7 +8014,7 @@ this.editorCtx.insertImage({ /** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte * * 最低基础库: `2.10.0` */ - length?: string, + length?: string ): string | ArrayBuffer } interface GeneralCallbackResult { @@ -8131,7 +8058,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offCanplay( /** 音频进入可以播放状态的事件的回调函数 */ - callback: OffCanplayCallback, + callback: OffCanplayCallback ): void /** [InnerAudioContext.offEnded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offEnded.html) * @@ -8140,7 +8067,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offEnded( /** 音频自然播放至结束的事件的回调函数 */ - callback: OffEndedCallback, + callback: OffEndedCallback ): void /** [InnerAudioContext.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offError.html) * @@ -8149,7 +8076,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offError( /** 音频播放错误事件的回调函数 */ - callback: InnerAudioContextOffErrorCallback, + callback: InnerAudioContextOffErrorCallback ): void /** [InnerAudioContext.offPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offPause.html) * @@ -8158,7 +8085,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offPause( /** 音频暂停事件的回调函数 */ - callback: OffPauseCallback, + callback: OffPauseCallback ): void /** [InnerAudioContext.offPlay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offPlay.html) * @@ -8167,7 +8094,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offPlay( /** 音频播放事件的回调函数 */ - callback: OffPlayCallback, + callback: OffPlayCallback ): void /** [InnerAudioContext.offSeeked(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offSeeked.html) * @@ -8176,7 +8103,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offSeeked( /** 音频完成跳转操作的事件的回调函数 */ - callback: OffSeekedCallback, + callback: OffSeekedCallback ): void /** [InnerAudioContext.offSeeking(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offSeeking.html) * @@ -8185,7 +8112,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offSeeking( /** 音频进行跳转操作的事件的回调函数 */ - callback: OffSeekingCallback, + callback: OffSeekingCallback ): void /** [InnerAudioContext.offStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offStop.html) * @@ -8194,7 +8121,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offStop( /** 音频停止事件的回调函数 */ - callback: OffStopCallback, + callback: OffStopCallback ): void /** [InnerAudioContext.offTimeUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offTimeUpdate.html) * @@ -8203,7 +8130,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offTimeUpdate( /** 音频播放进度更新事件的回调函数 */ - callback: OffTimeUpdateCallback, + callback: OffTimeUpdateCallback ): void /** [InnerAudioContext.offWaiting(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offWaiting.html) * @@ -8212,77 +8139,77 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offWaiting( /** 音频加载中事件的回调函数 */ - callback: OffWaitingCallback, + callback: OffWaitingCallback ): void /** [InnerAudioContext.onCanplay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onCanplay.html) * * 监听音频进入可以播放状态的事件。但不保证后面可以流畅播放 */ onCanplay( /** 音频进入可以播放状态的事件的回调函数 */ - callback: InnerAudioContextOnCanplayCallback, + callback: InnerAudioContextOnCanplayCallback ): void /** [InnerAudioContext.onEnded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onEnded.html) * * 监听音频自然播放至结束的事件 */ onEnded( /** 音频自然播放至结束的事件的回调函数 */ - callback: InnerAudioContextOnEndedCallback, + callback: InnerAudioContextOnEndedCallback ): void /** [InnerAudioContext.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onError.html) * * 监听音频播放错误事件 */ onError( /** 音频播放错误事件的回调函数 */ - callback: InnerAudioContextOnErrorCallback, + callback: InnerAudioContextOnErrorCallback ): void /** [InnerAudioContext.onPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onPause.html) * * 监听音频暂停事件 */ onPause( /** 音频暂停事件的回调函数 */ - callback: InnerAudioContextOnPauseCallback, + callback: InnerAudioContextOnPauseCallback ): void /** [InnerAudioContext.onPlay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onPlay.html) * * 监听音频播放事件 */ onPlay( /** 音频播放事件的回调函数 */ - callback: InnerAudioContextOnPlayCallback, + callback: InnerAudioContextOnPlayCallback ): void /** [InnerAudioContext.onSeeked(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onSeeked.html) * * 监听音频完成跳转操作的事件 */ onSeeked( /** 音频完成跳转操作的事件的回调函数 */ - callback: InnerAudioContextOnSeekedCallback, + callback: InnerAudioContextOnSeekedCallback ): void /** [InnerAudioContext.onSeeking(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onSeeking.html) * * 监听音频进行跳转操作的事件 */ onSeeking( /** 音频进行跳转操作的事件的回调函数 */ - callback: InnerAudioContextOnSeekingCallback, + callback: InnerAudioContextOnSeekingCallback ): void /** [InnerAudioContext.onStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onStop.html) * * 监听音频停止事件 */ onStop( /** 音频停止事件的回调函数 */ - callback: InnerAudioContextOnStopCallback, + callback: InnerAudioContextOnStopCallback ): void /** [InnerAudioContext.onTimeUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onTimeUpdate.html) * * 监听音频播放进度更新事件 */ onTimeUpdate( /** 音频播放进度更新事件的回调函数 */ - callback: InnerAudioContextOnTimeUpdateCallback, + callback: InnerAudioContextOnTimeUpdateCallback ): void /** [InnerAudioContext.onWaiting(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onWaiting.html) * * 监听音频加载中事件。当音频因为数据不足,需要停下来加载时会触发 */ onWaiting( /** 音频加载中事件的回调函数 */ - callback: InnerAudioContextOnWaitingCallback, + callback: OnWaitingCallback ): void /** [InnerAudioContext.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.pause.html) * @@ -8297,7 +8224,7 @@ this.editorCtx.insertImage({ * 跳转到指定位置 */ seek( /** 跳转的时间,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */ - position: number, + position: number ): void /** [InnerAudioContext.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.stop.html) * @@ -8316,7 +8243,7 @@ this.editorCtx.insertImage({ /** 选择器 */ targetSelector: string, /** 监听相交状态变化的回调函数 */ - callback: ObserveCallback, + callback: ObserveCallback ): void /** [[IntersectionObserver](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.html) IntersectionObserver.relativeTo(string selector, Object margins)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.relativeTo.html) * @@ -8325,7 +8252,7 @@ this.editorCtx.insertImage({ /** 选择器 */ selector: string, /** 用来扩展(或收缩)参照节点布局区域的边界 */ - margins?: RelativeToMargins, + margins?: Margins ): IntersectionObserver /** [[IntersectionObserver](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.html) IntersectionObserver.relativeToViewport(Object margins)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.relativeToViewport.html) * @@ -8351,7 +8278,7 @@ Page({ ``` */ relativeToViewport( /** 用来扩展(或收缩)参照节点布局区域的边界 */ - margins?: RelativeToViewportMargins, + margins?: Margins ): IntersectionObserver } interface InterstitialAd { @@ -8366,28 +8293,28 @@ Page({ * 取消监听插屏广告关闭事件 */ offClose( /** 插屏广告关闭事件的回调函数 */ - callback: InterstitialAdOffCloseCallback, + callback: InterstitialAdOffCloseCallback ): void /** [InterstitialAd.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offError.html) * * 取消监听插屏错误事件 */ offError( /** 插屏错误事件的回调函数 */ - callback: InterstitialAdOffErrorCallback, + callback: InterstitialAdOffErrorCallback ): void /** [InterstitialAd.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offLoad.html) * * 取消监听插屏广告加载事件 */ offLoad( /** 插屏广告加载事件的回调函数 */ - callback: InterstitialAdOffLoadCallback, + callback: InterstitialAdOffLoadCallback ): void /** [InterstitialAd.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onClose.html) * * 监听插屏广告关闭事件。 */ onClose( /** 插屏广告关闭事件的回调函数 */ - callback: InterstitialAdOnCloseCallback, + callback: InterstitialAdOnCloseCallback ): void /** [InterstitialAd.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onError.html) * @@ -8412,14 +8339,14 @@ Page({ * | 1008 | 广告单元已关闭 | 该广告位的广告能力已经被关闭 | 请前往mp.weixin.qq.com重新打开对应广告位的展现。| */ onError( /** 插屏错误事件的回调函数 */ - callback: InterstitialAdOnErrorCallback, + callback: InterstitialAdOnErrorCallback ): void /** [InterstitialAd.onLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onLoad.html) * * 监听插屏广告加载事件。 */ onLoad( /** 插屏广告加载事件的回调函数 */ - callback: InterstitialAdOnLoadCallback, + callback: InterstitialAdOnLoadCallback ): void /** [Promise InterstitialAd.load()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.load.html) * @@ -8472,7 +8399,7 @@ Page({ * * 进入全屏 */ requestFullScreen( - option: LivePlayerContextRequestFullScreenOption, + option: LivePlayerContextRequestFullScreenOption ): void /** [LivePlayerContext.resume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.resume.html) * @@ -8489,7 +8416,7 @@ Page({ /** 图片的质量,默认原图。有效值为 raw、compressed * * 最低基础库: `2.10.0` */ - quality?: string, + quality?: string ): void /** [LivePlayerContext.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.stop.html) * @@ -8544,7 +8471,7 @@ Page({ /** 图片的质量,默认原图。有效值为 raw、compressed * * 最低基础库: `2.10.0` */ - quality?: string, + quality?: string ): void /** [LivePusherContext.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.start.html) * @@ -8677,7 +8604,7 @@ Page({ /** [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) * * 要添加的音频或视频轨道 */ - track: MediaTrack, + track: MediaTrack ): void /** [MediaContainer.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.destroy.html) * @@ -8706,7 +8633,7 @@ Page({ /** [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) * * 要移除的音频或视频轨道 */ - track: MediaTrack, + track: MediaTrack ): void } interface NFCError { @@ -8775,7 +8702,7 @@ Page({ ``` */ boundingClientRect( /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */ - callback?: BoundingClientRectCallback, + callback?: BoundingClientRectCallback ): SelectorQuery /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.context(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.context.html) * @@ -8797,7 +8724,7 @@ Page({ * 最低基础库: `2.4.2` */ context( /** 回调函数,在执行 `SelectorQuery.exec` 方法后,返回节点信息。 */ - callback?: ContextCallback, + callback?: ContextCallback ): SelectorQuery /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.fields(Object fields, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.fields.html) * @@ -8840,7 +8767,7 @@ Page({ fields( fields: Fields, /** 回调函数 */ - callback?: FieldsCallback, + callback?: FieldsCallback ): SelectorQuery /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.node(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.node.html) * @@ -8862,7 +8789,7 @@ Page({ * 最低基础库: `2.7.0` */ node( /** 回调函数,在执行 `SelectorQuery.exec` 方法后,返回节点信息。 */ - callback?: NodeCallback, + callback?: NodeCallback ): SelectorQuery /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.scrollOffset(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.scrollOffset.html) * @@ -8885,7 +8812,7 @@ Page({ ``` */ scrollOffset( /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */ - callback?: ScrollOffsetCallback, + callback?: ScrollOffsetCallback ): SelectorQuery } interface OffscreenCanvas { @@ -8908,7 +8835,7 @@ Page({ * 最低基础库: `2.8.1` */ addFilterMsg( /** 是setFilterMsg的添加接口。用于设置多个过滤关键字。 */ - msg: string, + msg: string ): void /** [RealtimeLogManager.error()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.error.html) * @@ -8926,7 +8853,7 @@ Page({ * 最低基础库: `2.9.1` */ in( /** page实例 */ - pageInstance: Page.TrivialInstance, + pageInstance: Page.TrivialInstance ): void /** [RealtimeLogManager.info()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.info.html) * @@ -8944,7 +8871,7 @@ Page({ * 最低基础库: `2.7.3` */ setFilterMsg( /** 过滤关键字,最多不超过1Kb,可以在小程序管理后台根据设置的内容搜索得到对应的日志。 */ - msg: string, + msg: string ): void /** [RealtimeLogManager.warn()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.warn.html) * @@ -8962,14 +8889,14 @@ Page({ * 监听录音错误事件 */ onError( /** 录音错误事件的回调函数 */ - callback: RecorderManagerOnErrorCallback, + callback: RecorderManagerOnErrorCallback ): void /** [RecorderManager.onFrameRecorded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onFrameRecorded.html) * * 监听已录制完指定帧大小的文件事件。如果设置了 frameSize,则会回调此事件。 */ onFrameRecorded( /** 已录制完指定帧大小的文件事件的回调函数 */ - callback: OnFrameRecordedCallback, + callback: OnFrameRecordedCallback ): void /** [RecorderManager.onInterruptionBegin(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onInterruptionBegin.html) * @@ -8978,7 +8905,7 @@ Page({ * 最低基础库: `2.3.0` */ onInterruptionBegin( /** 录音因为受到系统占用而被中断开始事件的回调函数 */ - callback: OnInterruptionBeginCallback, + callback: OnInterruptionBeginCallback ): void /** [RecorderManager.onInterruptionEnd(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onInterruptionEnd.html) * @@ -8987,35 +8914,35 @@ Page({ * 最低基础库: `2.3.0` */ onInterruptionEnd( /** 录音中断结束事件的回调函数 */ - callback: OnInterruptionEndCallback, + callback: OnInterruptionEndCallback ): void /** [RecorderManager.onPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onPause.html) * * 监听录音暂停事件 */ onPause( /** 录音暂停事件的回调函数 */ - callback: RecorderManagerOnPauseCallback, + callback: RecorderManagerOnPauseCallback ): void /** [RecorderManager.onResume(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onResume.html) * * 监听录音继续事件 */ onResume( /** 录音继续事件的回调函数 */ - callback: OnResumeCallback, + callback: OnResumeCallback ): void /** [RecorderManager.onStart(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onStart.html) * * 监听录音开始事件 */ onStart( /** 录音开始事件的回调函数 */ - callback: OnStartCallback, + callback: OnStartCallback ): void /** [RecorderManager.onStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onStop.html) * * 监听录音结束事件 */ onStop( /** 录音结束事件的回调函数 */ - callback: RecorderManagerOnStopCallback, + callback: RecorderManagerOnStopCallback ): void /** [RecorderManager.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.pause.html) * @@ -9065,7 +8992,7 @@ Page({ * 最低基础库: `2.1.0` */ offHeadersReceived( /** HTTP Response Header 事件的回调函数 */ - callback: RequestTaskOffHeadersReceivedCallback, + callback: RequestTaskOffHeadersReceivedCallback ): void /** [RequestTask.onHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.onHeadersReceived.html) * @@ -9074,7 +9001,7 @@ Page({ * 最低基础库: `2.1.0` */ onHeadersReceived( /** HTTP Response Header 事件的回调函数 */ - callback: RequestTaskOnHeadersReceivedCallback, + callback: RequestTaskOnHeadersReceivedCallback ): void } interface RewardedVideoAd { @@ -9097,28 +9024,28 @@ Page({ * 取消监听用户点击 `关闭广告` 按钮的事件 */ offClose( /** 用户点击 `关闭广告` 按钮的事件的回调函数 */ - callback: RewardedVideoAdOffCloseCallback, + callback: RewardedVideoAdOffCloseCallback ): void /** [RewardedVideoAd.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offError.html) * * 取消监听激励视频错误事件 */ offError( /** 激励视频错误事件的回调函数 */ - callback: RewardedVideoAdOffErrorCallback, + callback: RewardedVideoAdOffErrorCallback ): void /** [RewardedVideoAd.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offLoad.html) * * 取消监听激励视频广告加载事件 */ offLoad( /** 激励视频广告加载事件的回调函数 */ - callback: RewardedVideoAdOffLoadCallback, + callback: RewardedVideoAdOffLoadCallback ): void /** [RewardedVideoAd.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onClose.html) * * 监听用户点击 `关闭广告` 按钮的事件。 */ onClose( /** 用户点击 `关闭广告` 按钮的事件的回调函数 */ - callback: RewardedVideoAdOnCloseCallback, + callback: RewardedVideoAdOnCloseCallback ): void /** [RewardedVideoAd.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onError.html) * @@ -9143,14 +9070,14 @@ Page({ * | 1008 | 广告单元已关闭 | 该广告位的广告能力已经被关闭 | 请前往mp.weixin.qq.com重新打开对应广告位的展现。| */ onError( /** 激励视频错误事件的回调函数 */ - callback: RewardedVideoAdOnErrorCallback, + callback: RewardedVideoAdOnErrorCallback ): void /** [RewardedVideoAd.onLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onLoad.html) * * 监听激励视频广告加载事件。 */ onLoad( /** 激励视频广告加载事件的回调函数 */ - callback: RewardedVideoAdOnLoadCallback, + callback: RewardedVideoAdOnLoadCallback ): void } interface SelectorQuery { @@ -9159,7 +9086,7 @@ Page({ * 执行所有的请求。请求结果按请求次序构成数组,在callback的第一个参数中返回。 */ exec( /** 回调函数 */ - callback?: (...args: any[]) => any, + callback?: (...args: any[]) => any ): NodesRef /** [[NodesRef](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.html) SelectorQuery.select(string selector)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.select.html) * @@ -9178,7 +9105,7 @@ Page({ * - 多选择器的并集:#a-node, .some-other-nodes */ select( /** 选择器 */ - selector: string, + selector: string ): NodesRef /** [[NodesRef](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.html) SelectorQuery.selectAll(string selector)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.selectAll.html) * @@ -9197,7 +9124,7 @@ Page({ * - 多选择器的并集:#a-node, .some-other-nodes */ selectAll( /** 选择器 */ - selector: string, + selector: string ): NodesRef /** [[NodesRef](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.html) SelectorQuery.selectViewport()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.selectViewport.html) * @@ -9224,7 +9151,7 @@ Component({ * 最低基础库: `1.6.0` */ in( /** 自定义组件实例 */ - component: Component.TrivialInstance | Page.TrivialInstance, + component: Component.TrivialInstance | Page.TrivialInstance ): SelectorQuery } interface SocketTask { @@ -9237,28 +9164,28 @@ Component({ * 监听 WebSocket 连接关闭事件 */ onClose( /** WebSocket 连接关闭事件的回调函数 */ - callback: SocketTaskOnCloseCallback, + callback: SocketTaskOnCloseCallback ): void /** [SocketTask.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onError.html) * * 监听 WebSocket 错误事件 */ onError( /** WebSocket 错误事件的回调函数 */ - callback: SocketTaskOnErrorCallback, + callback: SocketTaskOnErrorCallback ): void /** [SocketTask.onMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onMessage.html) * * 监听 WebSocket 接受到服务器的消息事件 */ onMessage( /** WebSocket 接受到服务器的消息事件的回调函数 */ - callback: SocketTaskOnMessageCallback, + callback: SocketTaskOnMessageCallback ): void /** [SocketTask.onOpen(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onOpen.html) * * 监听 WebSocket 连接打开事件 */ onOpen( /** WebSocket 连接打开事件的回调函数 */ - callback: OnOpenCallback, + callback: OnOpenCallback ): void /** [SocketTask.send(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.send.html) * @@ -9285,56 +9212,56 @@ Component({ * 取消监听关闭事件 */ offClose( /** 关闭事件的回调函数 */ - callback: UDPSocketOffCloseCallback, + callback: UDPSocketOffCloseCallback ): void /** [UDPSocket.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offError.html) * * 取消监听错误事件 */ offError( /** 错误事件的回调函数 */ - callback: UDPSocketOffErrorCallback, + callback: UDPSocketOffErrorCallback ): void /** [UDPSocket.offListening(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offListening.html) * * 取消监听开始监听数据包消息的事件 */ offListening( /** 开始监听数据包消息的事件的回调函数 */ - callback: OffListeningCallback, + callback: OffListeningCallback ): void /** [UDPSocket.offMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offMessage.html) * * 取消监听收到消息的事件 */ offMessage( /** 收到消息的事件的回调函数 */ - callback: OffMessageCallback, + callback: OffMessageCallback ): void /** [UDPSocket.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onClose.html) * * 监听关闭事件 */ onClose( /** 关闭事件的回调函数 */ - callback: UDPSocketOnCloseCallback, + callback: UDPSocketOnCloseCallback ): void /** [UDPSocket.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onError.html) * * 监听错误事件 */ onError( /** 错误事件的回调函数 */ - callback: UDPSocketOnErrorCallback, + callback: UDPSocketOnErrorCallback ): void /** [UDPSocket.onListening(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onListening.html) * * 监听开始监听数据包消息的事件 */ onListening( /** 开始监听数据包消息的事件的回调函数 */ - callback: OnListeningCallback, + callback: OnListeningCallback ): void /** [UDPSocket.onMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onMessage.html) * * 监听收到消息的事件 */ onMessage( /** 收到消息的事件的回调函数 */ - callback: UDPSocketOnMessageCallback, + callback: UDPSocketOnMessageCallback ): void /** [UDPSocket.send(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.send.html) * @@ -9347,7 +9274,7 @@ Component({ /** 指定要绑定的端口号,不传则返回系统随机分配的可用端口 * * 最低基础库: `2.9.0` */ - port?: number, + port?: number ): number } interface UpdateManager { @@ -9360,21 +9287,21 @@ Component({ * 监听向微信后台请求检查更新结果事件。微信在小程序冷启动时自动检查更新,不需由开发者主动触发。 */ onCheckForUpdate( /** 向微信后台请求检查更新结果事件的回调函数 */ - callback: OnCheckForUpdateCallback, + callback: OnCheckForUpdateCallback ): void /** [UpdateManager.onUpdateFailed(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateFailed.html) * * 监听小程序更新失败事件。小程序有新版本,客户端主动触发下载(无需开发者触发),下载失败(可能是网络原因等)后回调 */ onUpdateFailed( /** 小程序更新失败事件的回调函数 */ - callback: OnUpdateFailedCallback, + callback: OnUpdateFailedCallback ): void /** [UpdateManager.onUpdateReady(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateReady.html) * * 监听小程序有版本更新事件。客户端主动触发下载(无需开发者触发),下载成功后回调 */ onUpdateReady( /** 小程序有版本更新事件的回调函数 */ - callback: OnUpdateReadyCallback, + callback: OnUpdateReadyCallback ): void } interface UploadTask { @@ -9391,7 +9318,7 @@ Component({ * 最低基础库: `2.1.0` */ offHeadersReceived( /** HTTP Response Header 事件的回调函数 */ - callback: UploadTaskOffHeadersReceivedCallback, + callback: UploadTaskOffHeadersReceivedCallback ): void /** [UploadTask.offProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.offProgressUpdate.html) * @@ -9400,7 +9327,7 @@ Component({ * 最低基础库: `2.1.0` */ offProgressUpdate( /** 上传进度变化事件的回调函数 */ - callback: UploadTaskOffProgressUpdateCallback, + callback: UploadTaskOffProgressUpdateCallback ): void /** [UploadTask.onHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onHeadersReceived.html) * @@ -9409,7 +9336,7 @@ Component({ * 最低基础库: `2.1.0` */ onHeadersReceived( /** HTTP Response Header 事件的回调函数 */ - callback: UploadTaskOnHeadersReceivedCallback, + callback: UploadTaskOnHeadersReceivedCallback ): void /** [UploadTask.onProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onProgressUpdate.html) * @@ -9418,7 +9345,7 @@ Component({ * 最低基础库: `1.4.0` */ onProgressUpdate( /** 上传进度变化事件的回调函数 */ - callback: UploadTaskOnProgressUpdateCallback, + callback: UploadTaskOnProgressUpdateCallback ): void } interface VideoContext { @@ -9449,7 +9376,7 @@ Component({ * 最低基础库: `1.4.0` */ playbackRate( /** 倍率,支持 0.5/0.8/1.0/1.25/1.5,2.6.3 起支持 2.0 倍速 */ - rate: number, + rate: number ): void /** [VideoContext.requestFullScreen(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.requestFullScreen.html) * @@ -9462,14 +9389,14 @@ Component({ * 跳转到指定位置 */ seek( /** 跳转到的位置,单位 s */ - position: number, + position: number ): void /** [VideoContext.sendDanmu(Object data)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.sendDanmu.html) * * 发送弹幕 */ sendDanmu( /** 弹幕内容 */ - data: Danmu, + data: Danmu ): void /** [VideoContext.showStatusBar()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.showStatusBar.html) * @@ -9528,7 +9455,7 @@ Component({ * 监听主线程/Worker 线程向当前线程发送的消息的事件。 */ onMessage( /** 主线程/Worker 线程向当前线程发送的消息的事件的回调函数 */ - callback: WorkerOnMessageCallback, + callback: WorkerOnMessageCallback ): void /** [Worker.postMessage(Object message)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.postMessage.html) * @@ -9554,7 +9481,7 @@ worker.postMessage({ ``` */ postMessage( /** 需要发送的消息,必须是一个可序列化的 JavaScript key-value 形式的对象。 */ - message: IAnyObject, + message: IAnyObject ): void /** [Worker.terminate()](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.terminate.html) * @@ -9569,7 +9496,7 @@ worker.postMessage({ * 最低基础库: `1.1.0` */ base64ToArrayBuffer( /** 要转化成 ArrayBuffer 对象的 Base64 字符串 */ - base64: string, + base64: string ): ArrayBuffer /** [Object wx.getAccountInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/account-info/wx.getAccountInfoSync.html) * @@ -9729,7 +9656,7 @@ try { /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) wx.createAnimation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/wx.createAnimation.html) * * 创建一个动画实例 [animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html)。调用实例的方法来描述动画。最后通过动画实例的 export 方法导出动画数据传递给组件的 animation 属性。 */ - createAnimation(option: CreateAnimationOption): Animation + createAnimation(option: StepOption): Animation /** [[AudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.html) wx.createAudioContext(string id, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createAudioContext.html) * * 创建 [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 上下文 [AudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.html) 对象。 */ @@ -9737,7 +9664,7 @@ try { /** [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 组件的 id */ id: string, /** 在自定义组件下,当前组件实例的this,以操作组件内 [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 组件 */ - component?: Component.TrivialInstance | Page.TrivialInstance, + component?: Component.TrivialInstance | Page.TrivialInstance ): AudioContext /** [[BackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.html) wx.getBackgroundAudioManager()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) * @@ -9761,7 +9688,7 @@ try { /** 要获取上下文的 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 canvas-id 属性 */ canvasId: string, /** 在自定义组件下,当前组件实例的this,表示在这个自定义组件下查找拥有 canvas-id 的 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) ,如果省略则不在任何自定义组件内查找 */ - component?: Component.TrivialInstance | Page.TrivialInstance, + component?: Component.TrivialInstance | Page.TrivialInstance ): CanvasContext /** [[DownloadTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.html) wx.downloadFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/wx.downloadFile.html) * @@ -9812,7 +9739,7 @@ wx.downloadFile({ /** 自定义组件实例 */ component: IAnyObject, /** 选项 */ - options?: CreateIntersectionObserverOption, + options?: CreateIntersectionObserverOption ): IntersectionObserver /** [[InterstitialAd](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.html) wx.createInterstitialAd(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/wx.createInterstitialAd.html) * @@ -9829,7 +9756,7 @@ wx.downloadFile({ /** [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 组件的 id */ id: string, /** 在自定义组件下,当前组件实例的this,以操作组件内 [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 组件 */ - component?: Component.TrivialInstance | Page.TrivialInstance, + component?: Component.TrivialInstance | Page.TrivialInstance ): LivePlayerContext /** [[LivePusherContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.html) wx.createLivePusherContext()](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/wx.createLivePusherContext.html) * @@ -9861,7 +9788,7 @@ logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3]) /** [map](https://developers.weixin.qq.com/miniprogram/dev/component/map.html) 组件的 id */ mapId: string, /** 在自定义组件下,当前组件实例的this,以操作组件内 [map](https://developers.weixin.qq.com/miniprogram/dev/component/map.html) 组件 */ - component?: Component.TrivialInstance | Page.TrivialInstance, + component?: Component.TrivialInstance | Page.TrivialInstance ): MapContext /** [[MediaContainer](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.html) wx.createMediaContainer()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/wx.createMediaContainer.html) * @@ -9934,7 +9861,7 @@ wx.request({ * * 最低基础库: `2.0.4` */ createRewardedVideoAd( - option: CreateRewardedVideoAdOption, + option: CreateRewardedVideoAdOption ): RewardedVideoAd /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) wx.createSelectorQuery()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html) * @@ -10024,7 +9951,7 @@ wx.chooseImage({ /** [video](https://developers.weixin.qq.com/miniprogram/dev/component/video.html) 组件的 id */ id: string, /** 在自定义组件下,当前组件实例的this,以操作组件内 [video](https://developers.weixin.qq.com/miniprogram/dev/component/video.html) 组件 */ - component?: Component.TrivialInstance | Page.TrivialInstance, + component?: Component.TrivialInstance | Page.TrivialInstance ): VideoContext /** [[Worker](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.html) wx.createWorker(string scriptPath)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/wx.createWorker.html) * @@ -10033,7 +9960,7 @@ wx.chooseImage({ * 最低基础库: `1.9.90` */ createWorker( /** worker 入口文件的**绝对路径** */ - scriptPath: string, + scriptPath: string ): Worker /** [any wx.getStorageSync(string key)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageSync.html) * @@ -10063,7 +9990,7 @@ try { ``` */ getStorageSync( /** 本地缓存中指定的 key */ - key: string, + key: string ): any /** [boolean wx.canIUse(string schema)](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.canIUse.html) * @@ -10107,7 +10034,7 @@ wx.canIUse('button.open-type.contact') * 最低基础库: `1.1.1` */ canIUse( /** 使用 `${API}.${method}.${param}.${option}` 或者 `${component}.${attribute}.${option}` 方式来调用 */ - schema: string, + schema: string ): boolean /** [string wx.arrayBufferToBase64(ArrayBuffer arrayBuffer)](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.arrayBufferToBase64.html) * @@ -10116,7 +10043,7 @@ wx.canIUse('button.open-type.contact') * 最低基础库: `1.1.0` */ arrayBufferToBase64( /** 要转换成 Base64 字符串的 ArrayBuffer 对象 */ - arrayBuffer: ArrayBuffer, + arrayBuffer: ArrayBuffer ): string /** [wx.addCard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/card/wx.addCard.html) * @@ -10149,7 +10076,7 @@ wx.addCard({ * * 最低基础库: `1.1.0` */ addCard( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.addPhoneContact(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.addPhoneContact.html) * @@ -10157,7 +10084,7 @@ wx.addCard({ * * 最低基础库: `1.2.0` */ addPhoneContact( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.authorize(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorize.html) * @@ -10185,7 +10112,7 @@ wx.getSetting({ * * 最低基础库: `1.2.0` */ authorize( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.canvasGetImageData(Object object, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasGetImageData.html) * @@ -10216,7 +10143,7 @@ wx.canvasGetImageData({ canvasGetImageData( option: TOption, /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 */ - component?: Component.TrivialInstance | Page.TrivialInstance, + component?: Component.TrivialInstance | Page.TrivialInstance ): PromisifySuccessResult /** [wx.canvasPutImageData(Object object, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasPutImageData.html) * @@ -10226,7 +10153,7 @@ wx.canvasGetImageData({ canvasPutImageData( option: TOption, /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 */ - component?: Component.TrivialInstance | Page.TrivialInstance, + component?: Component.TrivialInstance | Page.TrivialInstance ): PromisifySuccessResult /** [wx.canvasToTempFilePath(Object object, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasToTempFilePath.html) * @@ -10234,7 +10161,7 @@ wx.canvasGetImageData({ canvasToTempFilePath( option: TOption, /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 */ - component?: Component.TrivialInstance | Page.TrivialInstance, + component?: Component.TrivialInstance | Page.TrivialInstance ): PromisifySuccessResult /** [wx.checkIsSoterEnrolledInDevice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.checkIsSoterEnrolledInDevice.html) * @@ -10256,7 +10183,7 @@ wx.checkIsSoterEnrolledInDevice({ checkIsSoterEnrolledInDevice< TOption extends CheckIsSoterEnrolledInDeviceOption >( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.checkIsSupportSoterAuthentication(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.checkIsSupportSoterAuthentication.html) * @@ -10279,7 +10206,7 @@ wx.checkIsSupportSoterAuthentication({ checkIsSupportSoterAuthentication< TOption extends CheckIsSupportSoterAuthenticationOption >( - option?: TOption, + option?: TOption ): PromisifySuccessResult< TOption, CheckIsSupportSoterAuthenticationOption @@ -10307,7 +10234,7 @@ wx.checkSession({ }) ``` */ checkSession( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.chooseAddress(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/address/wx.chooseAddress.html) * @@ -10334,14 +10261,8 @@ wx.chooseAddress({ * * 最低基础库: `1.1.0` */ chooseAddress( - option?: TOption, + option?: TOption ): PromisifySuccessResult - /** [wx.chooseContact(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.chooseContact.html) - * - * 拉起手机通讯录,选择联系人。 - * - * 最低基础库: `2.8.0` */ - chooseContact(option?: ChooseContactOption): void /** [wx.chooseImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html) * * 从本地相册选择图片或使用相机拍照。 @@ -10360,7 +10281,7 @@ wx.chooseImage({ }) ``` */ chooseImage( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.chooseInvoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoice.html) * @@ -10374,7 +10295,7 @@ wx.chooseImage({ * * 最低基础库: `2.3.0` */ chooseInvoice( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.chooseInvoiceTitle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoiceTitle.html) * @@ -10393,13 +10314,13 @@ wx.chooseInvoiceTitle({ * * 最低基础库: `1.5.0` */ chooseInvoiceTitle( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.chooseLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.chooseLocation.html) * * 打开地图选择位置。 */ chooseLocation( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.chooseMedia(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html) * @@ -10424,7 +10345,7 @@ wx.chooseMedia({ * * 最低基础库: `2.10.0` */ chooseMedia( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.chooseMessageFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseMessageFile.html) * @@ -10445,7 +10366,7 @@ wx.chooseMessageFile({ * * 最低基础库: `2.5.0` */ chooseMessageFile( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.chooseVideo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseVideo.html) * @@ -10465,7 +10386,7 @@ wx.chooseVideo({ }) ``` */ chooseVideo( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.clearStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorage.html) * @@ -10486,7 +10407,7 @@ try { } ``` */ clearStorage( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.clearStorageSync()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorageSync.html) * @@ -10526,7 +10447,7 @@ wx.closeBLEConnection({ * * 最低基础库: `1.1.0` */ closeBLEConnection( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.closeBluetoothAdapter(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.closeBluetoothAdapter.html) * @@ -10546,7 +10467,7 @@ wx.closeBluetoothAdapter({ * * 最低基础库: `1.1.0` */ closeBluetoothAdapter( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.closeSocket(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.closeSocket.html) * @@ -10572,7 +10493,7 @@ wx.onSocketClose(function(res) { }) ``` */ closeSocket( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.compressImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.compressImage.html) * @@ -10590,7 +10511,7 @@ wx.compressImage({ * * 最低基础库: `2.4.0` */ compressImage( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.connectWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.connectWifi.html) * @@ -10611,7 +10532,7 @@ wx.connectWifi({ * * 最低基础库: `1.6.0` */ connectWifi( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.createBLEConnection(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) * @@ -10642,7 +10563,7 @@ wx.createBLEConnection({ * * 最低基础库: `1.1.0` */ createBLEConnection( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.createBLEPeripheralServer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.createBLEPeripheralServer.html) * @@ -10652,7 +10573,7 @@ wx.createBLEConnection({ createBLEPeripheralServer< TOption extends CreateBLEPeripheralServerOption >( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.getAvailableAudioSources(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.getAvailableAudioSources.html) * @@ -10662,7 +10583,7 @@ wx.createBLEConnection({ getAvailableAudioSources< TOption extends GetAvailableAudioSourcesOption >( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.getBLEDeviceCharacteristics(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceCharacteristics.html) * @@ -10688,7 +10609,7 @@ wx.getBLEDeviceCharacteristics({ getBLEDeviceCharacteristics< TOption extends GetBLEDeviceCharacteristicsOption >( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.getBLEDeviceServices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceServices.html) * @@ -10710,7 +10631,7 @@ wx.getBLEDeviceServices({ * * 最低基础库: `1.1.0` */ getBLEDeviceServices( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.getBackgroundAudioPlayerState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioPlayerState.html) * @@ -10733,7 +10654,7 @@ wx.getBackgroundAudioPlayerState({ getBackgroundAudioPlayerState< TOption extends GetBackgroundAudioPlayerStateOption >( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.getBackgroundFetchData(object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchData.html) * @@ -10741,7 +10662,7 @@ wx.getBackgroundAudioPlayerState({ * * 最低基础库: `2.8.0` */ getBackgroundFetchData( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.getBackgroundFetchToken(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchToken.html) * @@ -10749,13 +10670,13 @@ wx.getBackgroundAudioPlayerState({ * * 最低基础库: `2.8.0` */ getBackgroundFetchToken( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.getBatteryInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfo.html) * * 获取设备电量。同步 API [wx.getBatteryInfoSync](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfoSync.html) 在 iOS 上不可用。 */ getBatteryInfo( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.getBeacons(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.getBeacons.html) * @@ -10763,7 +10684,7 @@ wx.getBackgroundAudioPlayerState({ * * 最低基础库: `1.2.0` */ getBeacons( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.getBluetoothAdapterState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getBluetoothAdapterState.html) * @@ -10785,7 +10706,7 @@ wx.getBluetoothAdapterState({ getBluetoothAdapterState< TOption extends GetBluetoothAdapterStateOption >( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.getBluetoothDevices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getBluetoothDevices.html) * @@ -10825,7 +10746,7 @@ wx.getBluetoothDevices({ * * 最低基础库: `1.1.0` */ getBluetoothDevices( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.getClipboardData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.getClipboardData.html) * @@ -10844,7 +10765,7 @@ wx.getClipboardData({ * * 最低基础库: `1.1.0` */ getClipboardData( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.getConnectedBluetoothDevices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getConnectedBluetoothDevices.html) * @@ -10866,7 +10787,7 @@ wx.getConnectedBluetoothDevices({ getConnectedBluetoothDevices< TOption extends GetConnectedBluetoothDevicesOption >( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.getConnectedWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.getConnectedWifi.html) * @@ -10874,7 +10795,7 @@ wx.getConnectedBluetoothDevices({ * * 最低基础库: `1.6.0` */ getConnectedWifi( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.getExtConfig(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfig.html) * @@ -10899,7 +10820,7 @@ if (wx.getExtConfig) { * * 最低基础库: `1.1.0` */ getExtConfig( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.getFileInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileInfo.html) * @@ -10919,26 +10840,8 @@ wx.getFileInfo({ * * 最低基础库: `1.4.0` */ getFileInfo( - option: TOption, + option: TOption ): PromisifySuccessResult - /** [wx.getGroupEnterInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.getGroupEnterInfo.html) -* -* 获取群工具栏启动信息 -* -* **示例代码** -* -* -* 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法)) 。 -* 获取得到的开放数据为以下 json 结构(其中 openGId 为当前群的唯一标识): -* -* ```json -{ - "openGId": "OPENGID" -} -``` -* -* 最低基础库: `2.10.4` */ - getGroupEnterInfo(option: GetGroupEnterInfoOption): void /** [wx.getHCEState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.getHCEState.html) * * 判断当前设备是否支持 HCE 能力。 @@ -10956,7 +10859,7 @@ wx.getHCEState({ * * 最低基础库: `1.7.0` */ getHCEState( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.getImageInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.getImageInfo.html) * @@ -10989,7 +10892,7 @@ wx.chooseImage({ }) ``` */ getImageInfo( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.getLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html) * @@ -11016,7 +10919,7 @@ wx.chooseImage({ * - 工具中定位模拟使用IP定位,可能会有一定误差。且工具目前仅支持 gcj02 坐标。 * - 使用第三方服务进行逆地址解析时,请确认第三方服务默认的坐标系,正确进行坐标转换。 */ getLocation( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.getNetworkType(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.getNetworkType.html) * @@ -11033,7 +10936,7 @@ wx.getNetworkType({ }) ``` */ getNetworkType( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.getSavedFileInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getSavedFileInfo.html) * @@ -11050,7 +10953,7 @@ wx.getSavedFileList({ }) ``` */ getSavedFileInfo( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.getSavedFileList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getSavedFileList.html) * @@ -11067,7 +10970,7 @@ wx.getSavedFileList({ }) ``` */ getSavedFileList( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.getScreenBrightness(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenBrightness.html) * @@ -11080,7 +10983,7 @@ wx.getSavedFileList({ * * 最低基础库: `1.2.0` */ getScreenBrightness( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.getSelectedTextRange(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/keyboard/wx.getSelectedTextRange.html) * @@ -11099,7 +11002,7 @@ wx.getSelectedTextRange({ * * 最低基础库: `2.7.0` */ getSelectedTextRange( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.getSetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.getSetting.html) * @@ -11145,7 +11048,7 @@ wx.getSetting({ * * 最低基础库: `1.2.0` */ getSetting( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.getShareInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.getShareInfo.html) * @@ -11198,7 +11101,7 @@ try { } ``` */ getStorage( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.getStorageInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfo.html) * @@ -11228,7 +11131,7 @@ try { } ``` */ getStorageInfo( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.getSystemInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfo.html) * @@ -11266,7 +11169,7 @@ try { } ``` */ getSystemInfo( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.getUserInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html) * @@ -11411,7 +11314,7 @@ wx.getWeRunData({ * * 最低基础库: `1.6.0` */ getWifiList( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.hideHomeButton(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideHomeButton.html) * @@ -11419,7 +11322,7 @@ wx.getWeRunData({ * * 最低基础库: `2.8.3` */ hideHomeButton( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.hideKeyboard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/keyboard/wx.hideKeyboard.html) * @@ -11438,7 +11341,7 @@ wx.hideKeyboard({ * * 最低基础库: `2.8.2` */ hideKeyboard( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.hideLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideLoading.html) * @@ -11446,7 +11349,7 @@ wx.hideKeyboard({ * * 最低基础库: `1.1.0` */ hideLoading( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.hideNavigationBarLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideNavigationBarLoading.html) * @@ -11454,7 +11357,7 @@ wx.hideKeyboard({ hideNavigationBarLoading< TOption extends HideNavigationBarLoadingOption >( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.hideShareMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.hideShareMenu.html) * @@ -11469,7 +11372,7 @@ wx.hideShareMenu() * * 最低基础库: `1.1.0` */ hideShareMenu( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.hideTabBar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBar.html) * @@ -11477,7 +11380,7 @@ wx.hideShareMenu() * * 最低基础库: `1.9.0` */ hideTabBar( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.hideTabBarRedDot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBarRedDot.html) * @@ -11485,13 +11388,13 @@ wx.hideShareMenu() * * 最低基础库: `1.9.0` */ hideTabBarRedDot( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.hideToast(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideToast.html) * * 隐藏消息提示框 */ hideToast( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.loadFontFace(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/font/wx.loadFontFace.html) * @@ -11519,7 +11422,7 @@ wx.loadFontFace({ * * 最低基础库: `2.1.0` */ loadFontFace( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.login(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html) * @@ -11559,13 +11462,13 @@ wx.makePhoneCall({ }) ``` */ makePhoneCall( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.navigateBack(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html) * * 关闭当前页面,返回上一页面或多级页面。可通过 [getCurrentPages](https://developers.weixin.qq.com/miniprogram/dev/reference/api/getCurrentPages.html) 获取当前的页面栈,决定需要返回几层。 */ navigateBack( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.navigateBackMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/miniprogram-navigate/wx.navigateBackMiniProgram.html) * @@ -11589,7 +11492,7 @@ success(res) { * * 最低基础库: `1.3.0` */ navigateBackMiniProgram( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.navigateTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateTo.html) * @@ -11635,7 +11538,7 @@ Page({ }) ``` */ navigateTo( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.navigateToMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/miniprogram-navigate/wx.navigateToMiniProgram.html) * @@ -11676,7 +11579,7 @@ wx.navigateToMiniProgram({ * * 最低基础库: `1.3.0` */ navigateToMiniProgram( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.nextTick(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/custom-component/wx.nextTick.html) * @@ -11744,7 +11647,7 @@ wx.notifyBLECharacteristicValueChange({ notifyBLECharacteristicValueChange< TOption extends NotifyBLECharacteristicValueChangeOption >( - option: TOption, + option: TOption ): PromisifySuccessResult< TOption, NotifyBLECharacteristicValueChangeOption @@ -11756,7 +11659,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.9.3` */ offAccelerometerChange( /** 加速度数据事件的回调函数 */ - callback: (...args: any[]) => any, + callback: (...args: any[]) => any ): void /** [wx.offAppHide(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppHide.html) * @@ -11765,7 +11668,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.1.2` */ offAppHide( /** 小程序切后台事件的回调函数 */ - callback: OffAppHideCallback, + callback: OffAppHideCallback ): void /** [wx.offAppShow(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppShow.html) * @@ -11774,7 +11677,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.1.2` */ offAppShow( /** 小程序切前台事件的回调函数 */ - callback: OffAppShowCallback, + callback: OffAppShowCallback ): void /** [wx.offAudioInterruptionBegin(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAudioInterruptionBegin.html) * @@ -11783,7 +11686,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.6.2` */ offAudioInterruptionBegin( /** 音频因为受到系统占用而被中断开始事件的回调函数 */ - callback: OffAudioInterruptionBeginCallback, + callback: OffAudioInterruptionBeginCallback ): void /** [wx.offAudioInterruptionEnd(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAudioInterruptionEnd.html) * @@ -11792,7 +11695,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.6.2` */ offAudioInterruptionEnd( /** 音频中断结束事件的回调函数 */ - callback: OffAudioInterruptionEndCallback, + callback: OffAudioInterruptionEndCallback ): void /** [wx.offBLECharacteristicValueChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.offBLECharacteristicValueChange.html) * @@ -11801,7 +11704,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.9.0` */ offBLECharacteristicValueChange( /** 低功耗蓝牙设备的特征值变化事件的回调函数 */ - callback: (...args: any[]) => any, + callback: (...args: any[]) => any ): void /** [wx.offBLEConnectionStateChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.offBLEConnectionStateChange.html) * @@ -11810,7 +11713,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.9.0` */ offBLEConnectionStateChange( /** 低功耗蓝牙连接状态的改变事件的回调函数 */ - callback: (...args: any[]) => any, + callback: (...args: any[]) => any ): void /** [wx.offBLEPeripheralConnectionStateChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBLEPeripheralConnectionStateChanged.html) * @@ -11819,7 +11722,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.10.3` */ offBLEPeripheralConnectionStateChanged( /** 当前外围设备被连接或断开连接事件的回调函数 */ - callback: OffBLEPeripheralConnectionStateChangedCallback, + callback: OffBLEPeripheralConnectionStateChangedCallback ): void /** [wx.offBeaconServiceChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconServiceChange.html) * @@ -11828,7 +11731,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.8.1` */ offBeaconServiceChange( /** iBeacon 服务状态变化事件的回调函数 */ - callback: OffBeaconServiceChangeCallback, + callback: OffBeaconServiceChangeCallback ): void /** [wx.offBeaconUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconUpdate.html) * @@ -11837,7 +11740,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.8.1` */ offBeaconUpdate( /** iBeacon 设备更新事件的回调函数 */ - callback: OffBeaconUpdateCallback, + callback: OffBeaconUpdateCallback ): void /** [wx.offBluetoothAdapterStateChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothAdapterStateChange.html) * @@ -11846,7 +11749,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.9.0` */ offBluetoothAdapterStateChange( /** 蓝牙适配器状态变化事件的回调函数 */ - callback: (...args: any[]) => any, + callback: (...args: any[]) => any ): void /** [wx.offBluetoothDeviceFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothDeviceFound.html) * @@ -11855,7 +11758,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.9.0` */ offBluetoothDeviceFound( /** 寻找到新设备的事件的回调函数 */ - callback: (...args: any[]) => any, + callback: (...args: any[]) => any ): void /** [wx.offCompassChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.offCompassChange.html) * @@ -11864,7 +11767,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.9.3` */ offCompassChange( /** 罗盘数据变化事件的回调函数 */ - callback: (...args: any[]) => any, + callback: (...args: any[]) => any ): void /** [wx.offDeviceMotionChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.offDeviceMotionChange.html) * @@ -11873,7 +11776,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.9.3` */ offDeviceMotionChange( /** 设备方向变化事件的回调函数 */ - callback: (...args: any[]) => any, + callback: (...args: any[]) => any ): void /** [wx.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offError.html) * @@ -11882,7 +11785,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.1.2` */ offError( /** 小程序错误事件的回调函数 */ - callback: (...args: any[]) => any, + callback: (...args: any[]) => any ): void /** [wx.offGetWifiList(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offGetWifiList.html) * @@ -11891,7 +11794,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.9.0` */ offGetWifiList( /** 获取到 Wi-Fi 列表数据事件的回调函数 */ - callback: (...args: any[]) => any, + callback: (...args: any[]) => any ): void /** [wx.offGyroscopeChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.offGyroscopeChange.html) * @@ -11900,7 +11803,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.9.3` */ offGyroscopeChange( /** 陀螺仪数据变化事件的回调函数 */ - callback: (...args: any[]) => any, + callback: (...args: any[]) => any ): void /** [wx.offHCEMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.offHCEMessage.html) * @@ -11909,7 +11812,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.8.1` */ offHCEMessage( /** 接收 NFC 设备消息事件的回调函数 */ - callback: (...args: any[]) => any, + callback: (...args: any[]) => any ): void /** [wx.offKeyboardHeightChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/aapi/ui/keyboard/wx.offKeyboardHeightChange.html) * @@ -11918,7 +11821,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.9.2` */ offKeyboardHeightChange( /** 键盘高度变化事件的回调函数 */ - callback: (...args: any[]) => any, + callback: (...args: any[]) => any ): void /** [wx.offLocalServiceDiscoveryStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceDiscoveryStop.html) * @@ -11927,7 +11830,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.4.0` */ offLocalServiceDiscoveryStop( /** mDNS 服务停止搜索的事件的回调函数 */ - callback: OffLocalServiceDiscoveryStopCallback, + callback: OffLocalServiceDiscoveryStopCallback ): void /** [wx.offLocalServiceFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceFound.html) * @@ -11936,7 +11839,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.4.0` */ offLocalServiceFound( /** mDNS 服务发现的事件的回调函数 */ - callback: OffLocalServiceFoundCallback, + callback: OffLocalServiceFoundCallback ): void /** [wx.offLocalServiceLost(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceLost.html) * @@ -11945,7 +11848,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.4.0` */ offLocalServiceLost( /** mDNS 服务离开的事件的回调函数 */ - callback: OffLocalServiceLostCallback, + callback: OffLocalServiceLostCallback ): void /** [wx.offLocalServiceResolveFail(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceResolveFail.html) * @@ -11954,7 +11857,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.4.0` */ offLocalServiceResolveFail( /** mDNS 服务解析失败的事件的回调函数 */ - callback: OffLocalServiceResolveFailCallback, + callback: OffLocalServiceResolveFailCallback ): void /** [wx.offLocationChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.offLocationChange.html) * @@ -11963,7 +11866,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.8.1` */ offLocationChange( /** 实时地理位置变化事件的回调函数 */ - callback: OffLocationChangeCallback, + callback: OffLocationChangeCallback ): void /** [wx.offMemoryWarning(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/performance/wx.offMemoryWarning.html) * @@ -11972,7 +11875,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.9.0` */ offMemoryWarning( /** 内存不足告警事件的回调函数 */ - callback: (...args: any[]) => any, + callback: (...args: any[]) => any ): void /** [wx.offNetworkStatusChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkStatusChange.html) * @@ -11981,7 +11884,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.9.3` */ offNetworkStatusChange( /** 网络状态变化事件的回调函数 */ - callback: (...args: any[]) => any, + callback: (...args: any[]) => any ): void /** [wx.offPageNotFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offPageNotFound.html) * @@ -11990,7 +11893,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.1.2` */ offPageNotFound( /** 小程序要打开的页面不存在事件的回调函数 */ - callback: OffPageNotFoundCallback, + callback: OffPageNotFoundCallback ): void /** [wx.offUnhandledRejection(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offUnhandledRejection.html) * @@ -11999,7 +11902,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.10.0` */ offUnhandledRejection( /** 未处理的 Promise 拒绝事件的回调函数 */ - callback: OffUnhandledRejectionCallback, + callback: OffUnhandledRejectionCallback ): void /** [wx.offUserCaptureScreen(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offUserCaptureScreen.html) * @@ -12008,7 +11911,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.9.3` */ offUserCaptureScreen( /** 用户主动截屏事件的回调函数 */ - callback: (...args: any[]) => any, + callback: (...args: any[]) => any ): void /** [wx.offWifiConnected(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offWifiConnected.html) * @@ -12017,7 +11920,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.9.0` */ offWifiConnected( /** 连接上 Wi-Fi 的事件的回调函数 */ - callback: (...args: any[]) => any, + callback: (...args: any[]) => any ): void /** [wx.offWindowResize(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.offWindowResize.html) * @@ -12026,7 +11929,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.3.0` */ offWindowResize( /** 窗口尺寸变化事件的回调函数 */ - callback: OffWindowResizeCallback, + callback: OffWindowResizeCallback ): void /** [wx.onAccelerometerChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.onAccelerometerChange.html) * @@ -12040,7 +11943,7 @@ wx.onAccelerometerChange(callback) ``` */ onAccelerometerChange( /** 加速度数据事件的回调函数 */ - callback: OnAccelerometerChangeCallback, + callback: OnAccelerometerChangeCallback ): void /** [wx.onAppHide(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppHide.html) * @@ -12049,7 +11952,7 @@ wx.onAccelerometerChange(callback) * 最低基础库: `2.1.2` */ onAppHide( /** 小程序切后台事件的回调函数 */ - callback: OnAppHideCallback, + callback: OnAppHideCallback ): void /** [wx.onAppShow(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppShow.html) * @@ -12075,7 +11978,7 @@ wx.onAccelerometerChange(callback) * 最低基础库: `2.1.2` */ onAppShow( /** 小程序切前台事件的回调函数 */ - callback: OnAppShowCallback, + callback: OnAppShowCallback ): void /** [wx.onAudioInterruptionBegin(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAudioInterruptionBegin.html) * @@ -12084,7 +11987,7 @@ wx.onAccelerometerChange(callback) * 最低基础库: `2.6.2` */ onAudioInterruptionBegin( /** 音频因为受到系统占用而被中断开始事件的回调函数 */ - callback: OnAudioInterruptionBeginCallback, + callback: OnAudioInterruptionBeginCallback ): void /** [wx.onAudioInterruptionEnd(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAudioInterruptionEnd.html) * @@ -12093,7 +11996,7 @@ wx.onAccelerometerChange(callback) * 最低基础库: `2.6.2` */ onAudioInterruptionEnd( /** 音频中断结束事件的回调函数 */ - callback: OnAudioInterruptionEndCallback, + callback: OnAudioInterruptionEndCallback ): void /** [wx.onBLECharacteristicValueChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLECharacteristicValueChange.html) * @@ -12124,7 +12027,7 @@ wx.onBLECharacteristicValueChange(function(res) { * 最低基础库: `1.1.0` */ onBLECharacteristicValueChange( /** 低功耗蓝牙设备的特征值变化事件的回调函数 */ - callback: OnBLECharacteristicValueChangeCallback, + callback: OnBLECharacteristicValueChangeCallback ): void /** [wx.onBLEConnectionStateChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLEConnectionStateChange.html) * @@ -12144,7 +12047,7 @@ wx.onBLEConnectionStateChange(function(res) { * 最低基础库: `1.1.0` */ onBLEConnectionStateChange( /** 低功耗蓝牙连接状态的改变事件的回调函数 */ - callback: OnBLEConnectionStateChangeCallback, + callback: OnBLEConnectionStateChangeCallback ): void /** [wx.onBLEPeripheralConnectionStateChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBLEPeripheralConnectionStateChanged.html) * @@ -12153,28 +12056,28 @@ wx.onBLEConnectionStateChange(function(res) { * 最低基础库: `2.10.3` */ onBLEPeripheralConnectionStateChanged( /** 当前外围设备被连接或断开连接事件的回调函数 */ - callback: OnBLEPeripheralConnectionStateChangedCallback, + callback: OnBLEPeripheralConnectionStateChangedCallback ): void /** [wx.onBackgroundAudioPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioPause.html) * * 监听音乐暂停事件。 */ onBackgroundAudioPause( /** 音乐暂停事件的回调函数 */ - callback: OnBackgroundAudioPauseCallback, + callback: OnBackgroundAudioPauseCallback ): void /** [wx.onBackgroundAudioPlay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioPlay.html) * * 监听音乐播放事件。 */ onBackgroundAudioPlay( /** 音乐播放事件的回调函数 */ - callback: OnBackgroundAudioPlayCallback, + callback: OnBackgroundAudioPlayCallback ): void /** [wx.onBackgroundAudioStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioStop.html) * * 监听音乐停止事件。 */ onBackgroundAudioStop( /** 音乐停止事件的回调函数 */ - callback: OnBackgroundAudioStopCallback, + callback: OnBackgroundAudioStopCallback ): void /** [wx.onBackgroundFetchData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.onBackgroundFetchData.html) * @@ -12182,7 +12085,7 @@ wx.onBLEConnectionStateChange(function(res) { * * 最低基础库: `2.8.0` */ onBackgroundFetchData( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.onBeaconServiceChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconServiceChange.html) * @@ -12191,7 +12094,7 @@ wx.onBLEConnectionStateChange(function(res) { * 最低基础库: `1.2.0` */ onBeaconServiceChange( /** iBeacon 服务状态变化事件的回调函数 */ - callback: OnBeaconServiceChangeCallback, + callback: OnBeaconServiceChangeCallback ): void /** [wx.onBeaconUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconUpdate.html) * @@ -12200,7 +12103,7 @@ wx.onBLEConnectionStateChange(function(res) { * 最低基础库: `1.2.0` */ onBeaconUpdate( /** iBeacon 设备更新事件的回调函数 */ - callback: OnBeaconUpdateCallback, + callback: OnBeaconUpdateCallback ): void /** [wx.onBluetoothAdapterStateChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothAdapterStateChange.html) * @@ -12219,7 +12122,7 @@ wx.onBluetoothAdapterStateChange(function (res) { * 最低基础库: `1.1.0` */ onBluetoothAdapterStateChange( /** 蓝牙适配器状态变化事件的回调函数 */ - callback: OnBluetoothAdapterStateChangeCallback, + callback: OnBluetoothAdapterStateChangeCallback ): void /** [wx.onBluetoothDeviceFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothDeviceFound.html) * @@ -12262,7 +12165,7 @@ wx.onBluetoothDeviceFound(function(res) { * 最低基础库: `1.1.0` */ onBluetoothDeviceFound( /** 寻找到新设备的事件的回调函数 */ - callback: OnBluetoothDeviceFoundCallback, + callback: OnBluetoothDeviceFoundCallback ): void /** [wx.onCompassChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.onCompassChange.html) * @@ -12286,7 +12189,7 @@ wx.onBluetoothDeviceFound(function(res) { * | unknow ${value} | 未知的精度枚举值,即该 Android 系统此时返回的表示精度的 value 不是一个标准的精度枚举值 | */ onCompassChange( /** 罗盘数据变化事件的回调函数 */ - callback: OnCompassChangeCallback, + callback: OnCompassChangeCallback ): void /** [wx.onDeviceMotionChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.onDeviceMotionChange.html) * @@ -12295,7 +12198,7 @@ wx.onBluetoothDeviceFound(function(res) { * 最低基础库: `2.3.0` */ onDeviceMotionChange( /** 设备方向变化事件的回调函数 */ - callback: OnDeviceMotionChangeCallback, + callback: OnDeviceMotionChangeCallback ): void /** [wx.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html) * @@ -12304,7 +12207,7 @@ wx.onBluetoothDeviceFound(function(res) { * 最低基础库: `2.1.2` */ onError( /** 小程序错误事件的回调函数 */ - callback: OnAppErrorCallback, + callback: OnAppErrorCallback ): void /** [wx.onGetWifiList(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onGetWifiList.html) * @@ -12313,7 +12216,7 @@ wx.onBluetoothDeviceFound(function(res) { * 最低基础库: `1.6.0` */ onGetWifiList( /** 获取到 Wi-Fi 列表数据事件的回调函数 */ - callback: OnGetWifiListCallback, + callback: OnGetWifiListCallback ): void /** [wx.onGyroscopeChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.onGyroscopeChange.html) * @@ -12322,7 +12225,7 @@ wx.onBluetoothDeviceFound(function(res) { * 最低基础库: `2.3.0` */ onGyroscopeChange( /** 陀螺仪数据变化事件的回调函数 */ - callback: OnGyroscopeChangeCallback, + callback: OnGyroscopeChangeCallback ): void /** [wx.onHCEMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.onHCEMessage.html) * @@ -12331,7 +12234,7 @@ wx.onBluetoothDeviceFound(function(res) { * 最低基础库: `1.7.0` */ onHCEMessage( /** 接收 NFC 设备消息事件的回调函数 */ - callback: OnHCEMessageCallback, + callback: OnHCEMessageCallback ): void /** [wx.onKeyboardHeightChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/keyboard/wx.onKeyboardHeightChange.html) * @@ -12355,7 +12258,7 @@ wx.onKeyboardHeightChange(res => { * 最低基础库: `2.4.0` */ onLocalServiceDiscoveryStop( /** mDNS 服务停止搜索的事件的回调函数 */ - callback: OnLocalServiceDiscoveryStopCallback, + callback: OnLocalServiceDiscoveryStopCallback ): void /** [wx.onLocalServiceFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceFound.html) * @@ -12364,7 +12267,7 @@ wx.onKeyboardHeightChange(res => { * 最低基础库: `2.4.0` */ onLocalServiceFound( /** mDNS 服务发现的事件的回调函数 */ - callback: OnLocalServiceFoundCallback, + callback: OnLocalServiceFoundCallback ): void /** [wx.onLocalServiceLost(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceLost.html) * @@ -12373,7 +12276,7 @@ wx.onKeyboardHeightChange(res => { * 最低基础库: `2.4.0` */ onLocalServiceLost( /** mDNS 服务离开的事件的回调函数 */ - callback: OnLocalServiceLostCallback, + callback: OnLocalServiceLostCallback ): void /** [wx.onLocalServiceResolveFail(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceResolveFail.html) * @@ -12382,7 +12285,7 @@ wx.onKeyboardHeightChange(res => { * 最低基础库: `2.4.0` */ onLocalServiceResolveFail( /** mDNS 服务解析失败的事件的回调函数 */ - callback: OnLocalServiceResolveFailCallback, + callback: OnLocalServiceResolveFailCallback ): void /** [wx.onLocationChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.onLocationChange.html) * @@ -12402,7 +12305,7 @@ wx.onKeyboardHeightChange(res => { * 最低基础库: `2.8.1` */ onLocationChange( /** 实时地理位置变化事件的回调函数 */ - callback: OnLocationChangeCallback, + callback: OnLocationChangeCallback ): void /** [wx.onMemoryWarning(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/performance/wx.onMemoryWarning.html) * @@ -12422,7 +12325,7 @@ wx.onKeyboardHeightChange(res => { * 最低基础库: `2.0.2` */ onMemoryWarning( /** 内存不足告警事件的回调函数 */ - callback: OnMemoryWarningCallback, + callback: OnMemoryWarningCallback ): void /** [wx.onNetworkStatusChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.onNetworkStatusChange.html) * @@ -12441,7 +12344,7 @@ wx.onNetworkStatusChange(function (res) { * 最低基础库: `1.1.0` */ onNetworkStatusChange( /** 网络状态变化事件的回调函数 */ - callback: OnNetworkStatusChangeCallback, + callback: OnNetworkStatusChangeCallback ): void /** [wx.onPageNotFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onPageNotFound.html) * @@ -12457,35 +12360,35 @@ wx.onNetworkStatusChange(function (res) { * 最低基础库: `2.1.2` */ onPageNotFound( /** 小程序要打开的页面不存在事件的回调函数 */ - callback: OnPageNotFoundCallback, + callback: OnPageNotFoundCallback ): void /** [wx.onSocketClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketClose.html) * * 监听 WebSocket 连接关闭事件 */ onSocketClose( /** WebSocket 连接关闭事件的回调函数 */ - callback: OnSocketCloseCallback, + callback: OnSocketCloseCallback ): void /** [wx.onSocketError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketError.html) * * 监听 WebSocket 错误事件 */ onSocketError( /** WebSocket 错误事件的回调函数 */ - callback: OnSocketErrorCallback, + callback: OnSocketErrorCallback ): void /** [wx.onSocketMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketMessage.html) * * 监听 WebSocket 接受到服务器的消息事件 */ onSocketMessage( /** WebSocket 接受到服务器的消息事件的回调函数 */ - callback: OnSocketMessageCallback, + callback: OnSocketMessageCallback ): void /** [wx.onSocketOpen(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketOpen.html) * * 监听 WebSocket 连接打开事件 */ onSocketOpen( /** WebSocket 连接打开事件的回调函数 */ - callback: OnSocketOpenCallback, + callback: OnSocketOpenCallback ): void /** [wx.onUnhandledRejection(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html) * @@ -12500,7 +12403,7 @@ wx.onNetworkStatusChange(function (res) { * 最低基础库: `2.10.0` */ onUnhandledRejection( /** 未处理的 Promise 拒绝事件的回调函数 */ - callback: OnUnhandledRejectionCallback, + callback: OnUnhandledRejectionCallback ): void /** [wx.onUserCaptureScreen(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.onUserCaptureScreen.html) * @@ -12518,7 +12421,7 @@ wx.onUserCaptureScreen(function (res) { * 最低基础库: `1.4.0` */ onUserCaptureScreen( /** 用户主动截屏事件的回调函数 */ - callback: OnUserCaptureScreenCallback, + callback: OnUserCaptureScreenCallback ): void /** [wx.onWifiConnected(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onWifiConnected.html) * @@ -12527,7 +12430,7 @@ wx.onUserCaptureScreen(function (res) { * 最低基础库: `1.6.0` */ onWifiConnected( /** 连接上 Wi-Fi 的事件的回调函数 */ - callback: OnWifiConnectedCallback, + callback: OnWifiConnectedCallback ): void /** [wx.onWindowResize(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.onWindowResize.html) * @@ -12536,11 +12439,11 @@ wx.onUserCaptureScreen(function (res) { * 最低基础库: `2.3.0` */ onWindowResize( /** 窗口尺寸变化事件的回调函数 */ - callback: OnWindowResizeCallback, + callback: OnWindowResizeCallback ): void /** [wx.openBluetoothAdapter(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html) * -* 初始化蓝牙模块 +* 初始化蓝牙模块。iOS 上开启主机/丛机模式时需分别调用一次,指定对应的 `mode`。 * * **object.fail 回调函数返回的 state 参数(仅 iOS)** * @@ -12573,7 +12476,7 @@ wx.openBluetoothAdapter({ * * 最低基础库: `1.1.0` */ openBluetoothAdapter( - option?: TOption, + option: TOption ): PromisifySuccessResult /** [wx.openCard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/card/wx.openCard.html) * @@ -12597,13 +12500,13 @@ wx.openCard({ * * 最低基础库: `1.1.0` */ openCard( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.openDocument(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.openDocument.html) * * 新开页面打开文档。微信客户端 `7.0.12` 版本前默认显示右上角菜单按钮,之后的版本默认不显示,需主动传入 `showMenu`。 */ openDocument( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.openLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.openLocation.html) * @@ -12627,15 +12530,12 @@ wx.openCard({ }) ``` */ openLocation( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.openSetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.openSetting.html) * * 调起客户端小程序设置界面,返回用户设置的操作结果。**设置界面只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。 * -* -* 注意:[2.3.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为后,才可以跳转打开设置页,管理授权信息。[详情](https://developers.weixin.qq.com/community/develop/doc/000cea2305cc5047af5733de751008) -* * **示例代码** * * @@ -12653,7 +12553,7 @@ wx.openSetting({ * * 最低基础库: `1.1.0` */ openSetting( - option?: TOption, + option: TOption ): PromisifySuccessResult /** [wx.pageScrollTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/wx.pageScrollTo.html) * @@ -12683,7 +12583,7 @@ wx.pageScrollTo({ * * 最低基础库: `1.4.0` */ pageScrollTo( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.pauseBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.pauseBackgroundAudio.html) * @@ -12696,7 +12596,7 @@ wx.pageScrollTo({ wx.pauseBackgroundAudio() ``` */ pauseBackgroundAudio( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.pauseVoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.pauseVoice.html) * @@ -12718,7 +12618,7 @@ wx.startRecord({ }) ``` */ pauseVoice( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.playBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.playBackgroundAudio.html) * @@ -12735,7 +12635,7 @@ wx.playBackgroundAudio({ }) ``` */ playBackgroundAudio( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.playVoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.playVoice.html) * @@ -12756,7 +12656,7 @@ wx.startRecord({ }) ``` */ playVoice( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.previewImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewImage.html) * @@ -12772,7 +12672,7 @@ wx.previewImage({ }) ``` */ previewImage( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.reLaunch(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.reLaunch.html) * @@ -12798,7 +12698,7 @@ wx.reLaunch({ * * 最低基础库: `1.1.0` */ reLaunch( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.readBLECharacteristicValue(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.readBLECharacteristicValue.html) * @@ -12837,7 +12737,7 @@ wx.readBLECharacteristicValue({ readBLECharacteristicValue< TOption extends ReadBLECharacteristicValueOption >( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.redirectTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.redirectTo.html) * @@ -12852,7 +12752,7 @@ wx.redirectTo({ }) ``` */ redirectTo( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.removeSavedFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.removeSavedFile.html) * @@ -12876,7 +12776,7 @@ wx.getSavedFileList({ }) ``` */ removeSavedFile( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.removeStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorage.html) * @@ -12902,7 +12802,7 @@ try { } ``` */ removeStorage( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.removeStorageSync(string key)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorageSync.html) * @@ -12929,7 +12829,7 @@ try { ``` */ removeStorageSync( /** 本地缓存中指定的 key */ - key: string, + key: string ): void /** [wx.removeTabBarBadge(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.removeTabBarBadge.html) * @@ -12937,7 +12837,7 @@ try { * * 最低基础库: `1.9.0` */ removeTabBarBadge( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.reportAnalytics(string eventName, Object data)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/data-analysis/wx.reportAnalytics.html) * @@ -12956,7 +12856,7 @@ wx.reportAnalytics('purchase', { /** 事件名 */ eventName: string, /** 上报的自定义数据,key 为配置中的字段名,value 为上报的数据。 */ - data: IAnyObject, + data: IAnyObject ): void /** [wx.reportMonitor(string name, number value)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/report/wx.reportMonitor.html) * @@ -12979,7 +12879,7 @@ wx.reportMonitor('1', 1) /** 监控ID,在「小程序管理后台」新建数据指标后获得 */ name: string, /** 上报数值,经处理后会在「小程序管理后台」上展示每分钟的上报总量 */ - value: number, + value: number ): void /** [wx.reportPerformance(Number id, Number value)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/wx.reportPerformance.html) * @@ -12997,7 +12897,7 @@ wx.reportPerformance(1101, 680) /** 指标 id */ id: number, /** 需要上报的数值 */ - value: number, + value: number ): void /** [wx.requestPayment(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/payment/wx.requestPayment.html) * @@ -13018,7 +12918,7 @@ wx.requestPayment({ }) ``` */ requestPayment( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.requestSubscribeMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html) * @@ -13059,7 +12959,7 @@ wx.requestSubscribeMessage({ * * 最低基础库: `2.4.4` */ requestSubscribeMessage( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.saveFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.saveFile.html) * @@ -13087,7 +12987,7 @@ wx.chooseImage({ * * 本地文件存储的大小限制为 10M */ saveFile( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.saveImageToPhotosAlbum(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html) * @@ -13104,7 +13004,7 @@ wx.saveImageToPhotosAlbum({ * * 最低基础库: `1.2.0` */ saveImageToPhotosAlbum( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.saveVideoToPhotosAlbum(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.saveVideoToPhotosAlbum.html) * @@ -13124,7 +13024,7 @@ wx.saveVideoToPhotosAlbum({ * * 最低基础库: `1.2.0` */ saveVideoToPhotosAlbum( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.scanCode(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/scan/wx.scanCode.html) * @@ -13150,7 +13050,7 @@ wx.scanCode({ }) ``` */ scanCode( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.seekBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.seekBackgroundAudio.html) * @@ -13165,7 +13065,7 @@ wx.seekBackgroundAudio({ }) ``` */ seekBackgroundAudio( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.sendHCEMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.sendHCEMessage.html) * @@ -13192,7 +13092,7 @@ wx.startHCE({ * * 最低基础库: `1.7.0` */ sendHCEMessage( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.sendSocketMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.sendSocketMessage.html) * @@ -13227,7 +13127,7 @@ function sendSocketMessage(msg) { } ``` */ sendSocketMessage( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.setBackgroundColor(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/background/wx.setBackgroundColor.html) * @@ -13249,7 +13149,7 @@ wx.setBackgroundColor({ * * 最低基础库: `2.1.0` */ setBackgroundColor( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.setBackgroundFetchToken(object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.setBackgroundFetchToken.html) * @@ -13257,7 +13157,7 @@ wx.setBackgroundColor({ * * 最低基础库: `2.8.0` */ setBackgroundFetchToken( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.setBackgroundTextStyle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/background/wx.setBackgroundTextStyle.html) * @@ -13274,7 +13174,7 @@ wx.setBackgroundTextStyle({ * * 最低基础库: `2.1.0` */ setBackgroundTextStyle( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.setClipboardData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.setClipboardData.html) * @@ -13298,7 +13198,7 @@ wx.setClipboardData({ * * 最低基础库: `1.1.0` */ setClipboardData( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.setEnableDebug(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html) * @@ -13326,7 +13226,7 @@ wx.setEnableDebug({ * * 最低基础库: `1.4.0` */ setEnableDebug( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.setInnerAudioOption(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.setInnerAudioOption.html) * @@ -13334,7 +13234,7 @@ wx.setEnableDebug({ * * 最低基础库: `2.3.0` */ setInnerAudioOption( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.setKeepScreenOn(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.setKeepScreenOn.html) * @@ -13351,7 +13251,7 @@ wx.setKeepScreenOn({ * * 最低基础库: `1.4.0` */ setKeepScreenOn( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.setNavigationBarColor(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.setNavigationBarColor.html) * @@ -13359,7 +13259,7 @@ wx.setKeepScreenOn({ * * 最低基础库: `1.4.0` */ setNavigationBarColor( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.setNavigationBarTitle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.setNavigationBarTitle.html) * @@ -13374,7 +13274,7 @@ wx.setNavigationBarTitle({ }) ``` */ setNavigationBarTitle( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.setScreenBrightness(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.setScreenBrightness.html) * @@ -13382,7 +13282,7 @@ wx.setNavigationBarTitle({ * * 最低基础库: `1.2.0` */ setScreenBrightness( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.setStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorage.html) * @@ -13403,7 +13303,7 @@ try { } catch (e) { } ``` */ setStorage( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.setStorageSync(string key, any data)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorageSync.html) * @@ -13427,7 +13327,7 @@ try { /** 本地缓存中指定的 key */ key: string, /** 需要存储的内容。只支持原生类型、Date、及能够通过`JSON.stringify`序列化的对象。 */ - data: any, + data: any ): void /** [wx.setTabBarBadge(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.setTabBarBadge.html) * @@ -13445,7 +13345,7 @@ wx.setTabBarBadge({ * * 最低基础库: `1.9.0` */ setTabBarBadge( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.setTabBarItem(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.setTabBarItem.html) * @@ -13465,7 +13365,7 @@ wx.setTabBarItem({ * * 最低基础库: `1.9.0` */ setTabBarItem( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.setTabBarStyle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.setTabBarStyle.html) * @@ -13485,7 +13385,7 @@ wx.setTabBarStyle({ * * 最低基础库: `1.9.0` */ setTabBarStyle( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.setTopBarText(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/sticky/wx.setTopBarText.html) * @@ -13507,7 +13407,7 @@ wx.setTopBarText({ * * 最低基础库: `1.4.3` */ setTopBarText( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.setWifiList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.setWifiList.html) * @@ -13544,7 +13444,7 @@ wx.getWifiList() * * 最低基础库: `1.6.0` */ setWifiList( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.setWindowSize(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.setWindowSize.html) * @@ -13577,7 +13477,7 @@ wx.showActionSheet({ * - Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel"; * - Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑 */ showActionSheet( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.showLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showLoading.html) * @@ -13604,7 +13504,7 @@ setTimeout(function () { * * 最低基础库: `1.1.0` */ showLoading( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.showModal(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showModal.html) * @@ -13633,7 +13533,7 @@ wx.showModal({ * - Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel"; * - Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑 */ showModal( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.showNavigationBarLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.showNavigationBarLoading.html) * @@ -13641,7 +13541,7 @@ wx.showModal({ showNavigationBarLoading< TOption extends ShowNavigationBarLoadingOption >( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.showRedPackage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/redpackage/wx.showRedPackage.html) * @@ -13649,7 +13549,7 @@ wx.showModal({ * * 最低基础库: `2.10.0` */ showRedPackage( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.showShareMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.showShareMenu.html) * @@ -13666,7 +13566,7 @@ wx.showShareMenu({ * * 最低基础库: `1.1.0` */ showShareMenu( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.showTabBar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBar.html) * @@ -13674,7 +13574,7 @@ wx.showShareMenu({ * * 最低基础库: `1.9.0` */ showTabBar( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.showTabBarRedDot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBarRedDot.html) * @@ -13682,7 +13582,7 @@ wx.showShareMenu({ * * 最低基础库: `1.9.0` */ showTabBarRedDot( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.showToast(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html) * @@ -13705,7 +13605,7 @@ wx.showToast({ * - [wx.showLoading](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showLoading.html) 和 [wx.showToast](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html) 同时只能显示一个 * - [wx.showToast](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html) 应与 [wx.hideToast](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideToast.html) 配对使用 */ showToast( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.startAccelerometer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.startAccelerometer.html) * @@ -13727,7 +13627,7 @@ wx.startAccelerometer({ * * 最低基础库: `1.1.0` */ startAccelerometer( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.startBeaconDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.startBeaconDiscovery.html) * @@ -13744,7 +13644,7 @@ wx.startBeaconDiscovery({ * * 最低基础库: `1.2.0` */ startBeaconDiscovery( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.startBluetoothDevicesDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.startBluetoothDevicesDiscovery.html) * @@ -13769,7 +13669,7 @@ wx.startBluetoothDevicesDiscovery({ startBluetoothDevicesDiscovery< TOption extends StartBluetoothDevicesDiscoveryOption >( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.startCompass(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.startCompass.html) * @@ -13784,7 +13684,7 @@ wx.startCompass() * * 最低基础库: `1.1.0` */ startCompass( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.startDeviceMotionListening(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.startDeviceMotionListening.html) * @@ -13794,7 +13694,7 @@ wx.startCompass() startDeviceMotionListening< TOption extends StartDeviceMotionListeningOption >( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.startGyroscope(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.startGyroscope.html) * @@ -13802,7 +13702,7 @@ wx.startCompass() * * 最低基础库: `2.3.0` */ startGyroscope( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.startHCE(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.startHCE.html) * @@ -13822,7 +13722,7 @@ wx.startHCE({ * * 最低基础库: `1.7.0` */ startHCE( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.startLocalServiceDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.startLocalServiceDiscovery.html) * @@ -13838,7 +13738,7 @@ wx.startHCE({ startLocalServiceDiscovery< TOption extends StartLocalServiceDiscoveryOption >( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.startLocationUpdate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdate.html) * @@ -13851,7 +13751,7 @@ wx.startHCE({ * * 最低基础库: `2.8.0` */ startLocationUpdate( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.startLocationUpdateBackground(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdateBackground.html) * @@ -13868,7 +13768,7 @@ wx.startHCE({ startLocationUpdateBackground< TOption extends StartLocationUpdateBackgroundOption >( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.startPullDownRefresh(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/pull-down-refresh/wx.startPullDownRefresh.html) * @@ -13883,7 +13783,7 @@ wx.startPullDownRefresh() * * 最低基础库: `1.5.0` */ startPullDownRefresh( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.startRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.startRecord.html) * @@ -13903,7 +13803,7 @@ setTimeout(function () { }, 10000) ``` */ startRecord( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.startSoterAuthentication(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.startSoterAuthentication.html) * @@ -13957,7 +13857,7 @@ wx.startSoterAuthentication({ startSoterAuthentication< TOption extends StartSoterAuthenticationOption >( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.startWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.startWifi.html) * @@ -13977,7 +13877,7 @@ wx.startWifi({ * * 最低基础库: `1.6.0` */ startWifi( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.stopAccelerometer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.stopAccelerometer.html) * @@ -13992,7 +13892,7 @@ wx.stopAccelerometer() * * 最低基础库: `1.1.0` */ stopAccelerometer( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.stopBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.stopBackgroundAudio.html) * @@ -14005,7 +13905,7 @@ wx.stopAccelerometer() wx.stopBackgroundAudio() ``` */ stopBackgroundAudio( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.stopBeaconDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.stopBeaconDiscovery.html) * @@ -14013,7 +13913,7 @@ wx.stopBackgroundAudio() * * 最低基础库: `1.2.0` */ stopBeaconDiscovery( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.stopBluetoothDevicesDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.stopBluetoothDevicesDiscovery.html) * @@ -14035,7 +13935,7 @@ wx.stopBluetoothDevicesDiscovery({ stopBluetoothDevicesDiscovery< TOption extends StopBluetoothDevicesDiscoveryOption >( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.stopCompass(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.stopCompass.html) * @@ -14050,7 +13950,7 @@ wx.stopCompass() * * 最低基础库: `1.1.0` */ stopCompass( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.stopDeviceMotionListening(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.stopDeviceMotionListening.html) * @@ -14060,7 +13960,7 @@ wx.stopCompass() stopDeviceMotionListening< TOption extends StopDeviceMotionListeningOption >( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.stopGyroscope(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.stopGyroscope.html) * @@ -14068,7 +13968,7 @@ wx.stopCompass() * * 最低基础库: `2.3.0` */ stopGyroscope( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.stopHCE(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.stopHCE.html) * @@ -14087,7 +13987,7 @@ wx.stopHCE({ * * 最低基础库: `1.7.0` */ stopHCE( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.stopLocalServiceDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.stopLocalServiceDiscovery.html) * @@ -14097,7 +13997,7 @@ wx.stopHCE({ stopLocalServiceDiscovery< TOption extends StopLocalServiceDiscoveryOption >( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.stopLocationUpdate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.stopLocationUpdate.html) * @@ -14105,7 +14005,7 @@ wx.stopHCE({ * * 最低基础库: `2.8.0` */ stopLocationUpdate( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.stopPullDownRefresh(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/pull-down-refresh/wx.stopPullDownRefresh.html) * @@ -14124,7 +14024,7 @@ Page({ * * 最低基础库: `1.5.0` */ stopPullDownRefresh( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.stopRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.stopRecord.html) * @@ -14144,7 +14044,7 @@ setTimeout(function () { }, 10000) ``` */ stopRecord( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.stopVoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.stopVoice.html) * @@ -14166,7 +14066,7 @@ wx.startRecord({ }) ``` */ stopVoice( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.stopWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.stopWifi.html) * @@ -14185,7 +14085,7 @@ wx.stopWifi({ * * 最低基础库: `1.6.0` */ stopWifi( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.switchTab(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.switchTab.html) * @@ -14214,7 +14114,7 @@ wx.switchTab({ }) ``` */ switchTab( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.updateShareMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.updateShareMenu.html) * @@ -14232,7 +14132,7 @@ wx.updateShareMenu({ * * 最低基础库: `1.2.0` */ updateShareMenu( - option: TOption, + option: TOption ): PromisifySuccessResult /** [wx.vibrateLong(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/vibrate/wx.vibrateLong.html) * @@ -14240,7 +14140,7 @@ wx.updateShareMenu({ * * 最低基础库: `1.2.0` */ vibrateLong( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.vibrateShort(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/vibrate/wx.vibrateShort.html) * @@ -14248,7 +14148,7 @@ wx.updateShareMenu({ * * 最低基础库: `1.2.0` */ vibrateShort( - option?: TOption, + option?: TOption ): PromisifySuccessResult /** [wx.writeBLECharacteristicValue(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.writeBLECharacteristicValue.html) * @@ -14291,7 +14191,7 @@ wx.writeBLECharacteristicValue({ writeBLECharacteristicValue< TOption extends WriteBLECharacteristicValueOption >( - option: TOption, + option: TOption ): PromisifySuccessResult< TOption, WriteBLECharacteristicValueOption @@ -14340,57 +14240,41 @@ wx.writeBLECharacteristicValue({ type AuthorizeFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type AuthorizeSuccessCallback = (res: GeneralCallbackResult) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type BLEPeripheralServerCloseCompleteCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用失败的回调函数 */ - type BLEPeripheralServerCloseFailCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用成功的回调函数 */ - type BLEPeripheralServerCloseSuccessCallback = ( - res: GeneralCallbackResult, - ) => void /** 背景音频进入可播放状态事件的回调函数 */ type BackgroundAudioManagerOnCanplayCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 背景音频自然播放结束事件的回调函数 */ type BackgroundAudioManagerOnEndedCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 背景音频播放错误事件的回调函数 */ type BackgroundAudioManagerOnErrorCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 背景音频暂停事件的回调函数 */ type BackgroundAudioManagerOnPauseCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 背景音频播放事件的回调函数 */ type BackgroundAudioManagerOnPlayCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 背景音频完成跳转操作事件的回调函数 */ type BackgroundAudioManagerOnSeekedCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 背景音频开始跳转操作事件的回调函数 */ type BackgroundAudioManagerOnSeekingCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 背景音频停止事件的回调函数 */ type BackgroundAudioManagerOnStopCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 背景音频播放进度更新事件的回调函数 */ type BackgroundAudioManagerOnTimeUpdateCallback = ( - res: GeneralCallbackResult, - ) => void - /** 音频加载中事件的回调函数 */ - type BackgroundAudioManagerOnWaitingCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type BlurCompleteCallback = (res: GeneralCallbackResult) => void @@ -14400,109 +14284,69 @@ wx.writeBLECharacteristicValue({ type BlurSuccessCallback = (res: GeneralCallbackResult) => void /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */ type BoundingClientRectCallback = ( - result: BoundingClientRectCallbackResult, - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type CameraContextStartRecordCompleteCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用失败的回调函数 */ - type CameraContextStartRecordFailCallback = ( - res: GeneralCallbackResult, + result: BoundingClientRectCallbackResult ) => void /** 接口调用成功的回调函数 */ type CameraContextStartRecordSuccessCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type CameraContextStopRecordCompleteCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用失败的回调函数 */ - type CameraContextStopRecordFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type CameraContextStopRecordSuccessCallback = ( - result: StopRecordSuccessCallbackResult, - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type CameraFrameListenerStartCompleteCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用失败的回调函数 */ - type CameraFrameListenerStartFailCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用成功的回调函数 */ - type CameraFrameListenerStartSuccessCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type CameraFrameListenerStopCompleteCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用失败的回调函数 */ - type CameraFrameListenerStopFailCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用成功的回调函数 */ - type CameraFrameListenerStopSuccessCallback = ( - res: GeneralCallbackResult, + result: StopRecordSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type CanvasGetImageDataCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type CanvasGetImageDataFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type CanvasGetImageDataSuccessCallback = ( - result: CanvasGetImageDataSuccessCallbackResult, + result: CanvasGetImageDataSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type CanvasPutImageDataCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type CanvasPutImageDataFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type CanvasPutImageDataSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type CanvasToTempFilePathCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type CanvasToTempFilePathFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type CanvasToTempFilePathSuccessCallback = ( - result: CanvasToTempFilePathSuccessCallbackResult, + result: CanvasToTempFilePathSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type CheckIsSoterEnrolledInDeviceCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type CheckIsSoterEnrolledInDeviceFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type CheckIsSoterEnrolledInDeviceSuccessCallback = ( - result: CheckIsSoterEnrolledInDeviceSuccessCallbackResult, + result: CheckIsSoterEnrolledInDeviceSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type CheckIsSupportSoterAuthenticationCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type CheckIsSupportSoterAuthenticationFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type CheckIsSupportSoterAuthenticationSuccessCallback = ( - result: CheckIsSupportSoterAuthenticationSuccessCallbackResult, + result: CheckIsSupportSoterAuthenticationSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type CheckSessionCompleteCallback = (res: GeneralCallbackResult) => void @@ -14516,15 +14360,7 @@ wx.writeBLECharacteristicValue({ type ChooseAddressFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type ChooseAddressSuccessCallback = ( - result: ChooseAddressSuccessCallbackResult, - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type ChooseContactCompleteCallback = (res: GeneralCallbackResult) => void - /** 接口调用失败的回调函数 */ - type ChooseContactFailCallback = (res: GeneralCallbackResult) => void - /** 接口调用成功的回调函数 */ - type ChooseContactSuccessCallback = ( - option: ChooseContactSuccessCallbackOption, + result: ChooseAddressSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ChooseImageCompleteCallback = (res: GeneralCallbackResult) => void @@ -14532,7 +14368,7 @@ wx.writeBLECharacteristicValue({ type ChooseImageFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type ChooseImageSuccessCallback = ( - result: ChooseImageSuccessCallbackResult, + result: ChooseImageSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ChooseInvoiceCompleteCallback = (res: GeneralCallbackResult) => void @@ -14540,17 +14376,17 @@ wx.writeBLECharacteristicValue({ type ChooseInvoiceFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type ChooseInvoiceSuccessCallback = ( - result: ChooseInvoiceSuccessCallbackResult, + result: ChooseInvoiceSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ChooseInvoiceTitleCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type ChooseInvoiceTitleFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type ChooseInvoiceTitleSuccessCallback = ( - result: ChooseInvoiceTitleSuccessCallbackResult, + result: ChooseInvoiceTitleSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ChooseLocationCompleteCallback = (res: GeneralCallbackResult) => void @@ -14558,7 +14394,7 @@ wx.writeBLECharacteristicValue({ type ChooseLocationFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type ChooseLocationSuccessCallback = ( - result: ChooseLocationSuccessCallbackResult, + result: ChooseLocationSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ChooseMediaCompleteCallback = (res: GeneralCallbackResult) => void @@ -14566,17 +14402,17 @@ wx.writeBLECharacteristicValue({ type ChooseMediaFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type ChooseMediaSuccessCallback = ( - result: ChooseMediaSuccessCallbackResult, + result: ChooseMediaSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ChooseMessageFileCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type ChooseMessageFileFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type ChooseMessageFileSuccessCallback = ( - result: ChooseMessageFileSuccessCallbackResult, + result: ChooseMessageFileSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ChooseVideoCompleteCallback = (res: GeneralCallbackResult) => void @@ -14584,7 +14420,7 @@ wx.writeBLECharacteristicValue({ type ChooseVideoFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type ChooseVideoSuccessCallback = ( - result: ChooseVideoSuccessCallbackResult, + result: ChooseVideoSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ClearCompleteCallback = (res: GeneralCallbackResult) => void @@ -14611,18 +14447,24 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type CloseBluetoothAdapterSuccessCallback = (res: BluetoothError) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type CloseCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type CloseFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type CloseSocketCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type CloseSocketFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type CloseSocketSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type CloseSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type CompressImageCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type CompressImageFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type CompressImageSuccessCallback = ( - result: CompressImageSuccessCallbackResult, + result: CompressImageSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ConnectSocketCompleteCallback = (res: GeneralCallbackResult) => void @@ -14652,15 +14494,15 @@ wx.writeBLECharacteristicValue({ type CreateBLEConnectionSuccessCallback = (res: BluetoothError) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type CreateBLEPeripheralServerCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type CreateBLEPeripheralServerFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type CreateBLEPeripheralServerSuccessCallback = ( - result: CreateBLEPeripheralServerSuccessCallbackResult, + result: CreateBLEPeripheralServerSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type DownloadFileCompleteCallback = (res: GeneralCallbackResult) => void @@ -14668,23 +14510,23 @@ wx.writeBLECharacteristicValue({ type DownloadFileFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type DownloadFileSuccessCallback = ( - result: DownloadFileSuccessCallbackResult, + result: DownloadFileSuccessCallbackResult ) => void /** HTTP Response Header 事件的回调函数 */ type DownloadTaskOffHeadersReceivedCallback = ( - res: GeneralCallbackResult, + result: OnHeadersReceivedCallbackResult ) => void /** 下载进度变化事件的回调函数 */ type DownloadTaskOffProgressUpdateCallback = ( - res: GeneralCallbackResult, + result: DownloadTaskOnProgressUpdateCallbackResult ) => void /** HTTP Response Header 事件的回调函数 */ type DownloadTaskOnHeadersReceivedCallback = ( - result: DownloadTaskOnHeadersReceivedCallbackResult, + result: OnHeadersReceivedCallbackResult ) => void /** 下载进度变化事件的回调函数 */ type DownloadTaskOnProgressUpdateCallback = ( - result: DownloadTaskOnProgressUpdateCallbackResult, + result: DownloadTaskOnProgressUpdateCallbackResult ) => void /** 事件监听函数 */ type EventCallback = ( @@ -14700,77 +14542,53 @@ wx.writeBLECharacteristicValue({ /** 回调函数 */ type FieldsCallback = ( /** 节点的相关信息 */ - res: IAnyObject, - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type FileSystemManagerGetFileInfoCompleteCallback = ( - res: GeneralCallbackResult, + res: IAnyObject ) => void /** 接口调用失败的回调函数 */ type FileSystemManagerGetFileInfoFailCallback = ( - result: GetFileInfoFailCallbackResult, + result: GetFileInfoFailCallbackResult ) => void /** 接口调用成功的回调函数 */ type FileSystemManagerGetFileInfoSuccessCallback = ( - result: FileSystemManagerGetFileInfoSuccessCallbackResult, - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type FileSystemManagerGetSavedFileListCompleteCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用失败的回调函数 */ - type FileSystemManagerGetSavedFileListFailCallback = ( - res: GeneralCallbackResult, + result: FileSystemManagerGetFileInfoSuccessCallbackResult ) => void /** 接口调用成功的回调函数 */ type FileSystemManagerGetSavedFileListSuccessCallback = ( - result: FileSystemManagerGetSavedFileListSuccessCallbackResult, - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type FileSystemManagerRemoveSavedFileCompleteCallback = ( - res: GeneralCallbackResult, + result: FileSystemManagerGetSavedFileListSuccessCallbackResult ) => void /** 接口调用失败的回调函数 */ type FileSystemManagerRemoveSavedFileFailCallback = ( - result: RemoveSavedFileFailCallbackResult, - ) => void - /** 接口调用成功的回调函数 */ - type FileSystemManagerRemoveSavedFileSuccessCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type FileSystemManagerSaveFileCompleteCallback = ( - res: GeneralCallbackResult, + result: RemoveSavedFileFailCallbackResult ) => void /** 接口调用失败的回调函数 */ type FileSystemManagerSaveFileFailCallback = ( - result: SaveFileFailCallbackResult, + result: SaveFileFailCallbackResult ) => void /** 接口调用成功的回调函数 */ type FileSystemManagerSaveFileSuccessCallback = ( - result: FileSystemManagerSaveFileSuccessCallbackResult, + result: FileSystemManagerSaveFileSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetAvailableAudioSourcesCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type GetAvailableAudioSourcesFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type GetAvailableAudioSourcesSuccessCallback = ( - result: GetAvailableAudioSourcesSuccessCallbackResult, + result: GetAvailableAudioSourcesSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetBLEDeviceCharacteristicsCompleteCallback = ( - res: BluetoothError, + res: BluetoothError ) => void /** 接口调用失败的回调函数 */ type GetBLEDeviceCharacteristicsFailCallback = (res: BluetoothError) => void /** 接口调用成功的回调函数 */ type GetBLEDeviceCharacteristicsSuccessCallback = ( - result: GetBLEDeviceCharacteristicsSuccessCallbackResult, + result: GetBLEDeviceCharacteristicsSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetBLEDeviceServicesCompleteCallback = (res: BluetoothError) => void @@ -14778,43 +14596,43 @@ wx.writeBLECharacteristicValue({ type GetBLEDeviceServicesFailCallback = (res: BluetoothError) => void /** 接口调用成功的回调函数 */ type GetBLEDeviceServicesSuccessCallback = ( - result: GetBLEDeviceServicesSuccessCallbackResult, + result: GetBLEDeviceServicesSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetBackgroundAudioPlayerStateCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type GetBackgroundAudioPlayerStateFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type GetBackgroundAudioPlayerStateSuccessCallback = ( - result: GetBackgroundAudioPlayerStateSuccessCallbackResult, + result: GetBackgroundAudioPlayerStateSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetBackgroundFetchDataCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type GetBackgroundFetchDataFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type GetBackgroundFetchDataSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetBackgroundFetchTokenCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type GetBackgroundFetchTokenFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type GetBackgroundFetchTokenSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetBatteryInfoCompleteCallback = (res: GeneralCallbackResult) => void @@ -14822,7 +14640,7 @@ wx.writeBLECharacteristicValue({ type GetBatteryInfoFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetBatteryInfoSuccessCallback = ( - result: GetBatteryInfoSuccessCallbackResult, + result: GetBatteryInfoSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetBeaconsCompleteCallback = (res: IBeaconError) => void @@ -14830,17 +14648,17 @@ wx.writeBLECharacteristicValue({ type GetBeaconsFailCallback = (res: IBeaconError) => void /** 接口调用成功的回调函数 */ type GetBeaconsSuccessCallback = ( - result: GetBeaconsSuccessCallbackResult, + result: GetBeaconsSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetBluetoothAdapterStateCompleteCallback = ( - res: BluetoothError, + res: BluetoothError ) => void /** 接口调用失败的回调函数 */ type GetBluetoothAdapterStateFailCallback = (res: BluetoothError) => void /** 接口调用成功的回调函数 */ type GetBluetoothAdapterStateSuccessCallback = ( - result: GetBluetoothAdapterStateSuccessCallbackResult, + result: GetBluetoothAdapterStateSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetBluetoothDevicesCompleteCallback = (res: BluetoothError) => void @@ -14848,17 +14666,17 @@ wx.writeBLECharacteristicValue({ type GetBluetoothDevicesFailCallback = (res: BluetoothError) => void /** 接口调用成功的回调函数 */ type GetBluetoothDevicesSuccessCallback = ( - result: GetBluetoothDevicesSuccessCallbackResult, + result: GetBluetoothDevicesSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetCenterLocationCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type GetCenterLocationFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetCenterLocationSuccessCallback = ( - result: GetCenterLocationSuccessCallbackResult, + result: GetCenterLocationSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetClipboardDataCompleteCallback = (res: GeneralCallbackResult) => void @@ -14866,19 +14684,19 @@ wx.writeBLECharacteristicValue({ type GetClipboardDataFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetClipboardDataSuccessCallback = ( - option: GetClipboardDataSuccessCallbackOption, + option: GetClipboardDataSuccessCallbackOption ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetConnectedBluetoothDevicesCompleteCallback = ( - res: BluetoothError, + res: BluetoothError ) => void /** 接口调用失败的回调函数 */ type GetConnectedBluetoothDevicesFailCallback = ( - res: BluetoothError, + res: BluetoothError ) => void /** 接口调用成功的回调函数 */ type GetConnectedBluetoothDevicesSuccessCallback = ( - result: GetConnectedBluetoothDevicesSuccessCallbackResult, + result: GetConnectedBluetoothDevicesSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetConnectedWifiCompleteCallback = (res: WifiError) => void @@ -14886,7 +14704,7 @@ wx.writeBLECharacteristicValue({ type GetConnectedWifiFailCallback = (res: WifiError) => void /** 接口调用成功的回调函数 */ type GetConnectedWifiSuccessCallback = ( - result: GetConnectedWifiSuccessCallbackResult, + result: GetConnectedWifiSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetContentsCompleteCallback = (res: GeneralCallbackResult) => void @@ -14894,7 +14712,7 @@ wx.writeBLECharacteristicValue({ type GetContentsFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetContentsSuccessCallback = ( - result: GetContentsSuccessCallbackResult, + result: GetContentsSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetExtConfigCompleteCallback = (res: GeneralCallbackResult) => void @@ -14902,18 +14720,10 @@ wx.writeBLECharacteristicValue({ type GetExtConfigFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetExtConfigSuccessCallback = ( - result: GetExtConfigSuccessCallbackResult, + result: GetExtConfigSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type GetGroupEnterInfoCompleteCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用失败的回调函数 */ - type GetGroupEnterInfoFailCallback = (res: GeneralCallbackResult) => void - /** 接口调用成功的回调函数 */ - type GetGroupEnterInfoSuccessCallback = ( - result: GetGroupEnterInfoSuccessCallbackResult, - ) => void + type GetFileInfoCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetHCEStateCompleteCallback = (res: NFCError) => void /** 接口调用失败的回调函数 */ @@ -14926,7 +14736,7 @@ wx.writeBLECharacteristicValue({ type GetImageInfoFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetImageInfoSuccessCallback = ( - result: GetImageInfoSuccessCallbackResult, + result: GetImageInfoSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetLocationCompleteCallback = (res: GeneralCallbackResult) => void @@ -14934,7 +14744,7 @@ wx.writeBLECharacteristicValue({ type GetLocationFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetLocationSuccessCallback = ( - result: GetLocationSuccessCallbackResult, + result: GetLocationSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetNetworkTypeCompleteCallback = (res: GeneralCallbackResult) => void @@ -14942,7 +14752,7 @@ wx.writeBLECharacteristicValue({ type GetNetworkTypeFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetNetworkTypeSuccessCallback = ( - result: GetNetworkTypeSuccessCallbackResult, + result: GetNetworkTypeSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetRegionCompleteCallback = (res: GeneralCallbackResult) => void @@ -14950,7 +14760,7 @@ wx.writeBLECharacteristicValue({ type GetRegionFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetRegionSuccessCallback = ( - result: GetRegionSuccessCallbackResult, + result: GetRegionSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetRotateCompleteCallback = (res: GeneralCallbackResult) => void @@ -14958,7 +14768,7 @@ wx.writeBLECharacteristicValue({ type GetRotateFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetRotateSuccessCallback = ( - result: GetRotateSuccessCallbackResult, + result: GetRotateSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetSavedFileInfoCompleteCallback = (res: GeneralCallbackResult) => void @@ -14966,35 +14776,39 @@ wx.writeBLECharacteristicValue({ type GetSavedFileInfoFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetSavedFileInfoSuccessCallback = ( - result: GetSavedFileInfoSuccessCallbackResult, + result: GetSavedFileInfoSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type GetSavedFileListCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type GetSavedFileListFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetScaleCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type GetScaleFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetScaleSuccessCallback = ( - result: GetScaleSuccessCallbackResult, + result: GetScaleSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetScreenBrightnessCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type GetScreenBrightnessFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetScreenBrightnessSuccessCallback = ( - option: GetScreenBrightnessSuccessCallbackOption, + option: GetScreenBrightnessSuccessCallbackOption ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetSelectedTextRangeCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type GetSelectedTextRangeFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetSelectedTextRangeSuccessCallback = ( - result: GetSelectedTextRangeSuccessCallbackResult, + result: GetSelectedTextRangeSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetSelectionTextCompleteCallback = (res: GeneralCallbackResult) => void @@ -15002,7 +14816,7 @@ wx.writeBLECharacteristicValue({ type GetSelectionTextFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetSelectionTextSuccessCallback = ( - result: GetSelectionTextSuccessCallbackResult, + result: GetSelectionTextSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetSettingCompleteCallback = (res: GeneralCallbackResult) => void @@ -15010,7 +14824,7 @@ wx.writeBLECharacteristicValue({ type GetSettingFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetSettingSuccessCallback = ( - result: GetSettingSuccessCallbackResult, + result: GetSettingSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetShareInfoCompleteCallback = (res: GeneralCallbackResult) => void @@ -15018,7 +14832,7 @@ wx.writeBLECharacteristicValue({ type GetShareInfoFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetShareInfoSuccessCallback = ( - result: GetShareInfoSuccessCallbackResult, + result: GetShareInfoSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetSkewCompleteCallback = (res: GeneralCallbackResult) => void @@ -15036,11 +14850,11 @@ wx.writeBLECharacteristicValue({ type GetStorageInfoFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetStorageInfoSuccessCallback = ( - option: GetStorageInfoSuccessCallbackOption, + option: GetStorageInfoSuccessCallbackOption ) => void /** 接口调用成功的回调函数 */ type GetStorageSuccessCallback = ( - result: GetStorageSuccessCallbackResult, + result: GetStorageSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetSystemInfoCompleteCallback = (res: GeneralCallbackResult) => void @@ -15048,7 +14862,7 @@ wx.writeBLECharacteristicValue({ type GetSystemInfoFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetSystemInfoSuccessCallback = ( - result: GetSystemInfoSuccessCallbackResult, + result: GetSystemInfoSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetUserInfoCompleteCallback = (res: GeneralCallbackResult) => void @@ -15056,7 +14870,7 @@ wx.writeBLECharacteristicValue({ type GetUserInfoFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetUserInfoSuccessCallback = ( - result: GetUserInfoSuccessCallbackResult, + result: GetUserInfoSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetWeRunDataCompleteCallback = (res: GeneralCallbackResult) => void @@ -15064,7 +14878,7 @@ wx.writeBLECharacteristicValue({ type GetWeRunDataFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type GetWeRunDataSuccessCallback = ( - result: GetWeRunDataSuccessCallbackResult, + result: GetWeRunDataSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetWifiListCompleteCallback = (res: WifiError) => void @@ -15092,15 +14906,15 @@ wx.writeBLECharacteristicValue({ type HideLoadingSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type HideNavigationBarLoadingCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type HideNavigationBarLoadingFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type HideNavigationBarLoadingSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type HideShareMenuCompleteCallback = (res: GeneralCallbackResult) => void @@ -15134,17 +14948,17 @@ wx.writeBLECharacteristicValue({ type IncludePointsSuccessCallback = (res: GeneralCallbackResult) => void /** 音频播放错误事件的回调函数 */ type InnerAudioContextOffErrorCallback = ( - res: GeneralCallbackResult, + result: InnerAudioContextOnErrorCallbackResult ) => void /** 音频进入可以播放状态的事件的回调函数 */ type InnerAudioContextOnCanplayCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 音频自然播放至结束的事件的回调函数 */ type InnerAudioContextOnEndedCallback = (res: GeneralCallbackResult) => void /** 音频播放错误事件的回调函数 */ type InnerAudioContextOnErrorCallback = ( - result: InnerAudioContextOnErrorCallbackResult, + result: InnerAudioContextOnErrorCallbackResult ) => void /** 音频暂停事件的回调函数 */ type InnerAudioContextOnPauseCallback = (res: GeneralCallbackResult) => void @@ -15152,21 +14966,17 @@ wx.writeBLECharacteristicValue({ type InnerAudioContextOnPlayCallback = (res: GeneralCallbackResult) => void /** 音频完成跳转操作的事件的回调函数 */ type InnerAudioContextOnSeekedCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 音频进行跳转操作的事件的回调函数 */ type InnerAudioContextOnSeekingCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 音频停止事件的回调函数 */ type InnerAudioContextOnStopCallback = (res: GeneralCallbackResult) => void /** 音频播放进度更新事件的回调函数 */ type InnerAudioContextOnTimeUpdateCallback = ( - res: GeneralCallbackResult, - ) => void - /** 音频加载中事件的回调函数 */ - type InnerAudioContextOnWaitingCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type InsertDividerCompleteCallback = (res: GeneralCallbackResult) => void @@ -15189,112 +14999,30 @@ wx.writeBLECharacteristicValue({ /** 插屏广告关闭事件的回调函数 */ type InterstitialAdOffCloseCallback = (res: GeneralCallbackResult) => void /** 插屏错误事件的回调函数 */ - type InterstitialAdOffErrorCallback = (res: GeneralCallbackResult) => void + type InterstitialAdOffErrorCallback = ( + result: InterstitialAdOnErrorCallbackResult + ) => void /** 插屏广告加载事件的回调函数 */ type InterstitialAdOffLoadCallback = (res: GeneralCallbackResult) => void /** 插屏广告关闭事件的回调函数 */ type InterstitialAdOnCloseCallback = (res: GeneralCallbackResult) => void /** 插屏错误事件的回调函数 */ type InterstitialAdOnErrorCallback = ( - result: InterstitialAdOnErrorCallbackResult, + result: InterstitialAdOnErrorCallbackResult ) => void /** 插屏广告加载事件的回调函数 */ type InterstitialAdOnLoadCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type LivePlayerContextPauseCompleteCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用失败的回调函数 */ - type LivePlayerContextPauseFailCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用成功的回调函数 */ - type LivePlayerContextPauseSuccessCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type LivePlayerContextResumeCompleteCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用失败的回调函数 */ - type LivePlayerContextResumeFailCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用成功的回调函数 */ - type LivePlayerContextResumeSuccessCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type LivePlayerContextStopCompleteCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用失败的回调函数 */ - type LivePlayerContextStopFailCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用成功的回调函数 */ - type LivePlayerContextStopSuccessCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type LivePusherContextPauseCompleteCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用失败的回调函数 */ - type LivePusherContextPauseFailCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用成功的回调函数 */ - type LivePusherContextPauseSuccessCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type LivePusherContextResumeCompleteCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用失败的回调函数 */ - type LivePusherContextResumeFailCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用成功的回调函数 */ - type LivePusherContextResumeSuccessCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type LivePusherContextStartCompleteCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用失败的回调函数 */ - type LivePusherContextStartFailCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用成功的回调函数 */ - type LivePusherContextStartSuccessCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type LivePusherContextStopCompleteCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用失败的回调函数 */ - type LivePusherContextStopFailCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用成功的回调函数 */ - type LivePusherContextStopSuccessCallback = ( - res: GeneralCallbackResult, - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type LoadFontFaceCompleteCallback = ( - result: LoadFontFaceCompleteCallbackResult, + result: LoadFontFaceCompleteCallbackResult ) => void /** 接口调用失败的回调函数 */ type LoadFontFaceFailCallback = ( - result: LoadFontFaceFailCallbackResult, + result: LoadFontFaceCompleteCallbackResult ) => void /** 接口调用成功的回调函数 */ type LoadFontFaceSuccessCallback = ( - result: LoadFontFaceSuccessCallbackResult, + result: LoadFontFaceCompleteCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type LoginCompleteCallback = (res: GeneralCallbackResult) => void @@ -15332,15 +15060,15 @@ wx.writeBLECharacteristicValue({ type NavigateBackFailCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type NavigateBackMiniProgramCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type NavigateBackMiniProgramFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type NavigateBackMiniProgramSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type NavigateBackSuccessCallback = (res: GeneralCallbackResult) => void @@ -15350,49 +15078,49 @@ wx.writeBLECharacteristicValue({ type NavigateToFailCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type NavigateToMiniProgramCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type NavigateToMiniProgramFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type NavigateToMiniProgramSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type NavigateToSuccessCallback = ( - result: NavigateToSuccessCallbackResult, + result: NavigateToSuccessCallbackResult ) => void /** 回调函数,在执行 `SelectorQuery.exec` 方法后,返回节点信息。 */ type NodeCallback = (result: NodeCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type NotifyBLECharacteristicValueChangeCompleteCallback = ( - res: BluetoothError, + res: BluetoothError ) => void /** 接口调用失败的回调函数 */ type NotifyBLECharacteristicValueChangeFailCallback = ( - res: BluetoothError, + res: BluetoothError ) => void /** 接口调用成功的回调函数 */ type NotifyBLECharacteristicValueChangeSuccessCallback = ( - res: BluetoothError, + res: BluetoothError ) => void /** 监听相交状态变化的回调函数 */ type ObserveCallback = (result: ObserveCallbackResult) => void /** 小程序切后台事件的回调函数 */ type OffAppHideCallback = (res: GeneralCallbackResult) => void /** 小程序切前台事件的回调函数 */ - type OffAppShowCallback = (res: GeneralCallbackResult) => void + type OffAppShowCallback = (result: OffAppShowCallbackResult) => void /** 音频因为受到系统占用而被中断开始事件的回调函数 */ type OffAudioInterruptionBeginCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 音频中断结束事件的回调函数 */ type OffAudioInterruptionEndCallback = (res: GeneralCallbackResult) => void /** 当前外围设备被连接或断开连接事件的回调函数 */ type OffBLEPeripheralConnectionStateChangedCallback = ( - res: GeneralCallbackResult, + result: OnBLEPeripheralConnectionStateChangedCallbackResult ) => void /** iBeacon 服务状态变化事件的回调函数 */ type OffBeaconServiceChangeCallback = (res: GeneralCallbackResult) => void @@ -15402,11 +15130,11 @@ wx.writeBLECharacteristicValue({ type OffCanplayCallback = (res: GeneralCallbackResult) => void /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ type OffCharacteristicReadRequestCallback = ( - res: GeneralCallbackResult, + result: OnCharacteristicReadRequestCallbackResult ) => void /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */ type OffCharacteristicWriteRequestCallback = ( - res: GeneralCallbackResult, + result: OnCharacteristicWriteRequestCallbackResult ) => void /** 音频自然播放至结束的事件的回调函数 */ type OffEndedCallback = (res: GeneralCallbackResult) => void @@ -15414,22 +15142,30 @@ wx.writeBLECharacteristicValue({ type OffListeningCallback = (res: GeneralCallbackResult) => void /** mDNS 服务停止搜索的事件的回调函数 */ type OffLocalServiceDiscoveryStopCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** mDNS 服务发现的事件的回调函数 */ - type OffLocalServiceFoundCallback = (res: GeneralCallbackResult) => void + type OffLocalServiceFoundCallback = ( + result: OnLocalServiceFoundCallbackResult + ) => void /** mDNS 服务离开的事件的回调函数 */ - type OffLocalServiceLostCallback = (res: GeneralCallbackResult) => void + type OffLocalServiceLostCallback = ( + result: OnLocalServiceLostCallbackResult + ) => void /** mDNS 服务解析失败的事件的回调函数 */ type OffLocalServiceResolveFailCallback = ( - res: GeneralCallbackResult, + result: OnLocalServiceLostCallbackResult ) => void /** 实时地理位置变化事件的回调函数 */ - type OffLocationChangeCallback = (res: GeneralCallbackResult) => void + type OffLocationChangeCallback = ( + result: OnLocationChangeCallbackResult + ) => void /** 收到消息的事件的回调函数 */ - type OffMessageCallback = (res: GeneralCallbackResult) => void + type OffMessageCallback = (result: OffMessageCallbackResult) => void /** 小程序要打开的页面不存在事件的回调函数 */ - type OffPageNotFoundCallback = (res: GeneralCallbackResult) => void + type OffPageNotFoundCallback = ( + result: OnPageNotFoundCallbackResult + ) => void /** 音频暂停事件的回调函数 */ type OffPauseCallback = (res: GeneralCallbackResult) => void /** 音频播放事件的回调函数 */ @@ -15443,19 +15179,23 @@ wx.writeBLECharacteristicValue({ /** 音频播放进度更新事件的回调函数 */ type OffTimeUpdateCallback = (res: GeneralCallbackResult) => void /** 未处理的 Promise 拒绝事件的回调函数 */ - type OffUnhandledRejectionCallback = (res: GeneralCallbackResult) => void + type OffUnhandledRejectionCallback = ( + result: OnUnhandledRejectionCallbackResult + ) => void /** 音频加载中事件的回调函数 */ type OffWaitingCallback = (res: GeneralCallbackResult) => void /** 窗口尺寸变化事件的回调函数 */ - type OffWindowResizeCallback = (res: GeneralCallbackResult) => void + type OffWindowResizeCallback = ( + result: OffWindowResizeCallbackResult + ) => void /** 加速度数据事件的回调函数 */ type OnAccelerometerChangeCallback = ( - result: OnAccelerometerChangeCallbackResult, + result: OnAccelerometerChangeCallbackResult ) => void /** 小程序错误事件的回调函数 */ type OnAppErrorCallback = ( /** 错误信息,包含堆栈 */ - error: string, + error: string ) => void /** 小程序切后台事件的回调函数 */ type OnAppHideCallback = (res: GeneralCallbackResult) => void @@ -15467,15 +15207,15 @@ wx.writeBLECharacteristicValue({ type OnAudioInterruptionEndCallback = (res: GeneralCallbackResult) => void /** 低功耗蓝牙设备的特征值变化事件的回调函数 */ type OnBLECharacteristicValueChangeCallback = ( - result: OnBLECharacteristicValueChangeCallbackResult, + result: OnBLECharacteristicValueChangeCallbackResult ) => void /** 低功耗蓝牙连接状态的改变事件的回调函数 */ type OnBLEConnectionStateChangeCallback = ( - result: OnBLEConnectionStateChangeCallbackResult, + result: OnBLEConnectionStateChangeCallbackResult ) => void /** 当前外围设备被连接或断开连接事件的回调函数 */ type OnBLEPeripheralConnectionStateChangedCallback = ( - result: OnBLEPeripheralConnectionStateChangedCallbackResult, + result: OnBLEPeripheralConnectionStateChangedCallbackResult ) => void /** 音乐暂停事件的回调函数 */ type OnBackgroundAudioPauseCallback = (res: GeneralCallbackResult) => void @@ -15485,61 +15225,61 @@ wx.writeBLECharacteristicValue({ type OnBackgroundAudioStopCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type OnBackgroundFetchDataCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type OnBackgroundFetchDataFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type OnBackgroundFetchDataSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** iBeacon 服务状态变化事件的回调函数 */ type OnBeaconServiceChangeCallback = ( - result: OnBeaconServiceChangeCallbackResult, + result: OnBeaconServiceChangeCallbackResult ) => void /** iBeacon 设备更新事件的回调函数 */ type OnBeaconUpdateCallback = (result: OnBeaconUpdateCallbackResult) => void /** 蓝牙适配器状态变化事件的回调函数 */ type OnBluetoothAdapterStateChangeCallback = ( - result: OnBluetoothAdapterStateChangeCallbackResult, + result: OnBluetoothAdapterStateChangeCallbackResult ) => void /** 寻找到新设备的事件的回调函数 */ type OnBluetoothDeviceFoundCallback = ( - result: OnBluetoothDeviceFoundCallbackResult, + result: OnBluetoothDeviceFoundCallbackResult ) => void /** 回调函数 */ type OnCameraFrameCallback = (result: OnCameraFrameCallbackResult) => void /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ type OnCharacteristicReadRequestCallback = ( - result: OnCharacteristicReadRequestCallbackResult, + result: OnCharacteristicReadRequestCallbackResult ) => void /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */ type OnCharacteristicWriteRequestCallback = ( - result: OnCharacteristicWriteRequestCallbackResult, + result: OnCharacteristicWriteRequestCallbackResult ) => void /** 向微信后台请求检查更新结果事件的回调函数 */ type OnCheckForUpdateCallback = ( - result: OnCheckForUpdateCallbackResult, + result: OnCheckForUpdateCallbackResult ) => void /** 罗盘数据变化事件的回调函数 */ type OnCompassChangeCallback = ( - result: OnCompassChangeCallbackResult, + result: OnCompassChangeCallbackResult ) => void /** 设备方向变化事件的回调函数 */ type OnDeviceMotionChangeCallback = ( - result: OnDeviceMotionChangeCallbackResult, + result: OnDeviceMotionChangeCallbackResult ) => void /** 已录制完指定帧大小的文件事件的回调函数 */ type OnFrameRecordedCallback = ( - result: OnFrameRecordedCallbackResult, + result: OnFrameRecordedCallbackResult ) => void /** 获取到 Wi-Fi 列表数据事件的回调函数 */ type OnGetWifiListCallback = (result: OnGetWifiListCallbackResult) => void /** 陀螺仪数据变化事件的回调函数 */ type OnGyroscopeChangeCallback = ( - result: OnGyroscopeChangeCallbackResult, + result: OnGyroscopeChangeCallbackResult ) => void /** 接收 NFC 设备消息事件的回调函数 */ type OnHCEMessageCallback = (result: OnHCEMessageCallbackResult) => void @@ -15548,37 +15288,37 @@ wx.writeBLECharacteristicValue({ /** 录音中断结束事件的回调函数 */ type OnInterruptionEndCallback = (res: GeneralCallbackResult) => void type OnKeyboardHeightChangeCallback = ( - result: OnKeyboardHeightChangeCallbackResult, + result: OnKeyboardHeightChangeCallbackResult ) => void /** 开始监听数据包消息的事件的回调函数 */ type OnListeningCallback = (res: GeneralCallbackResult) => void /** mDNS 服务停止搜索的事件的回调函数 */ type OnLocalServiceDiscoveryStopCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** mDNS 服务发现的事件的回调函数 */ type OnLocalServiceFoundCallback = ( - result: OnLocalServiceFoundCallbackResult, + result: OnLocalServiceFoundCallbackResult ) => void /** mDNS 服务离开的事件的回调函数 */ type OnLocalServiceLostCallback = ( - result: OnLocalServiceLostCallbackResult, + result: OnLocalServiceLostCallbackResult ) => void /** mDNS 服务解析失败的事件的回调函数 */ type OnLocalServiceResolveFailCallback = ( - result: OnLocalServiceResolveFailCallbackResult, + result: OnLocalServiceLostCallbackResult ) => void /** 实时地理位置变化事件的回调函数 */ type OnLocationChangeCallback = ( - result: OnLocationChangeCallbackResult, + result: OnLocationChangeCallbackResult ) => void /** 内存不足告警事件的回调函数 */ type OnMemoryWarningCallback = ( - result: OnMemoryWarningCallbackResult, + result: OnMemoryWarningCallbackResult ) => void /** 网络状态变化事件的回调函数 */ type OnNetworkStatusChangeCallback = ( - result: OnNetworkStatusChangeCallbackResult, + result: OnNetworkStatusChangeCallbackResult ) => void /** 用户在系统音乐播放面板点击下一曲事件的回调函数 */ type OnNextCallback = (res: GeneralCallbackResult) => void @@ -15591,12 +15331,16 @@ wx.writeBLECharacteristicValue({ /** 录音继续事件的回调函数 */ type OnResumeCallback = (res: GeneralCallbackResult) => void /** WebSocket 连接关闭事件的回调函数 */ - type OnSocketCloseCallback = (result: OnSocketCloseCallbackResult) => void + type OnSocketCloseCallback = ( + result: SocketTaskOnCloseCallbackResult + ) => void /** WebSocket 错误事件的回调函数 */ - type OnSocketErrorCallback = (result: OnSocketErrorCallbackResult) => void + type OnSocketErrorCallback = ( + result: UDPSocketOnErrorCallbackResult + ) => void /** WebSocket 接受到服务器的消息事件的回调函数 */ type OnSocketMessageCallback = ( - result: OnSocketMessageCallbackResult, + result: SocketTaskOnMessageCallbackResult ) => void /** WebSocket 连接打开事件的回调函数 */ type OnSocketOpenCallback = (result: OnSocketOpenCallbackResult) => void @@ -15604,7 +15348,7 @@ wx.writeBLECharacteristicValue({ type OnStartCallback = (res: GeneralCallbackResult) => void /** 未处理的 Promise 拒绝事件的回调函数 */ type OnUnhandledRejectionCallback = ( - result: OnUnhandledRejectionCallbackResult, + result: OnUnhandledRejectionCallbackResult ) => void /** 小程序更新失败事件的回调函数 */ type OnUpdateFailedCallback = (res: GeneralCallbackResult) => void @@ -15612,9 +15356,11 @@ wx.writeBLECharacteristicValue({ type OnUpdateReadyCallback = (res: GeneralCallbackResult) => void /** 用户主动截屏事件的回调函数 */ type OnUserCaptureScreenCallback = (res: GeneralCallbackResult) => void + /** 音频加载中事件的回调函数 */ + type OnWaitingCallback = (res: GeneralCallbackResult) => void /** 连接上 Wi-Fi 的事件的回调函数 */ type OnWifiConnectedCallback = ( - result: OnWifiConnectedCallbackResult, + result: OnWifiConnectedCallbackResult ) => void /** 窗口尺寸变化事件的回调函数 */ type OnWindowResizeCallback = (result: OnWindowResizeCallbackResult) => void @@ -15648,7 +15394,7 @@ wx.writeBLECharacteristicValue({ type OpenSettingFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type OpenSettingSuccessCallback = ( - result: OpenSettingSuccessCallbackResult, + result: OpenSettingSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type PageScrollToCompleteCallback = (res: GeneralCallbackResult) => void @@ -15664,15 +15410,21 @@ wx.writeBLECharacteristicValue({ type PauseBGMSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type PauseBackgroundAudioCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type PauseBackgroundAudioFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type PauseBackgroundAudioSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type PauseCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type PauseFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type PauseSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type PauseVoiceCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type PauseVoiceFailCallback = (res: GeneralCallbackResult) => void @@ -15686,13 +15438,13 @@ wx.writeBLECharacteristicValue({ type PlayBGMSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type PlayBackgroundAudioCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type PlayBackgroundAudioFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type PlayBackgroundAudioSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type PlayCompleteCallback = (res: GeneralCallbackResult) => void @@ -15720,13 +15472,13 @@ wx.writeBLECharacteristicValue({ type ReLaunchSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ReadBLECharacteristicValueCompleteCallback = ( - res: BluetoothError, + res: BluetoothError ) => void /** 接口调用失败的回调函数 */ type ReadBLECharacteristicValueFailCallback = (res: BluetoothError) => void /** 接口调用成功的回调函数 */ type ReadBLECharacteristicValueSuccessCallback = ( - res: BluetoothError, + res: BluetoothError ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ReadFileCompleteCallback = (res: GeneralCallbackResult) => void @@ -15734,7 +15486,7 @@ wx.writeBLECharacteristicValue({ type ReadFileFailCallback = (result: ReadFileFailCallbackResult) => void /** 接口调用成功的回调函数 */ type ReadFileSuccessCallback = ( - result: ReadFileSuccessCallbackResult, + result: ReadFileSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ReaddirCompleteCallback = (res: GeneralCallbackResult) => void @@ -15744,7 +15496,7 @@ wx.writeBLECharacteristicValue({ type ReaddirSuccessCallback = (result: ReaddirSuccessCallbackResult) => void /** 录音错误事件的回调函数 */ type RecorderManagerOnErrorCallback = ( - result: RecorderManagerOnErrorCallbackResult, + result: UDPSocketOnErrorCallbackResult ) => void /** 录音暂停事件的回调函数 */ type RecorderManagerOnPauseCallback = (res: GeneralCallbackResult) => void @@ -15769,6 +15521,10 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type RemoveFormatSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type RemoveSavedFileCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type RemoveSavedFileSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type RemoveServiceCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type RemoveServiceFailCallback = (res: GeneralCallbackResult) => void @@ -15782,7 +15538,7 @@ wx.writeBLECharacteristicValue({ type RemoveStorageSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type RemoveTabBarBadgeCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type RemoveTabBarBadgeFailCallback = (res: GeneralCallbackResult) => void @@ -15800,7 +15556,7 @@ wx.writeBLECharacteristicValue({ type RequestFailCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type RequestFullScreenCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type RequestFullScreenFailCallback = (res: GeneralCallbackResult) => void @@ -15814,25 +15570,25 @@ wx.writeBLECharacteristicValue({ type RequestPaymentSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type RequestSubscribeMessageCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type RequestSubscribeMessageFailCallback = ( - result: RequestSubscribeMessageFailCallbackResult, + result: RequestSubscribeMessageFailCallbackResult ) => void /** 接口调用成功的回调函数 */ type RequestSubscribeMessageSuccessCallback = ( - result: RequestSubscribeMessageSuccessCallbackResult, + result: RequestSubscribeMessageSuccessCallbackResult ) => void /** 接口调用成功的回调函数 */ type RequestSuccessCallback = (result: RequestSuccessCallbackResult) => void /** HTTP Response Header 事件的回调函数 */ type RequestTaskOffHeadersReceivedCallback = ( - res: GeneralCallbackResult, + result: OnHeadersReceivedCallbackResult ) => void /** HTTP Response Header 事件的回调函数 */ type RequestTaskOnHeadersReceivedCallback = ( - result: RequestTaskOnHeadersReceivedCallbackResult, + result: OnHeadersReceivedCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ResumeBGMCompleteCallback = (res: GeneralCallbackResult) => void @@ -15840,19 +15596,29 @@ wx.writeBLECharacteristicValue({ type ResumeBGMFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type ResumeBGMSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type ResumeCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type ResumeFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type ResumeSuccessCallback = (res: GeneralCallbackResult) => void /** 用户点击 `关闭广告` 按钮的事件的回调函数 */ - type RewardedVideoAdOffCloseCallback = (res: GeneralCallbackResult) => void + type RewardedVideoAdOffCloseCallback = ( + result: RewardedVideoAdOnCloseCallbackResult + ) => void /** 激励视频错误事件的回调函数 */ - type RewardedVideoAdOffErrorCallback = (res: GeneralCallbackResult) => void + type RewardedVideoAdOffErrorCallback = ( + result: RewardedVideoAdOnErrorCallbackResult + ) => void /** 激励视频广告加载事件的回调函数 */ type RewardedVideoAdOffLoadCallback = (res: GeneralCallbackResult) => void /** 用户点击 `关闭广告` 按钮的事件的回调函数 */ type RewardedVideoAdOnCloseCallback = ( - result: RewardedVideoAdOnCloseCallbackResult, + result: RewardedVideoAdOnCloseCallbackResult ) => void /** 激励视频错误事件的回调函数 */ type RewardedVideoAdOnErrorCallback = ( - result: RewardedVideoAdOnErrorCallbackResult, + result: RewardedVideoAdOnErrorCallbackResult ) => void /** 激励视频广告加载事件的回调函数 */ type RewardedVideoAdOnLoadCallback = (res: GeneralCallbackResult) => void @@ -15863,28 +15629,30 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type RmdirSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type SaveFileCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SaveImageToPhotosAlbumCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type SaveImageToPhotosAlbumFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type SaveImageToPhotosAlbumSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SaveVideoToPhotosAlbumCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type SaveVideoToPhotosAlbumFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type SaveVideoToPhotosAlbumSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ScanCodeCompleteCallback = (res: GeneralCallbackResult) => void @@ -15892,19 +15660,19 @@ wx.writeBLECharacteristicValue({ type ScanCodeFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type ScanCodeSuccessCallback = ( - result: ScanCodeSuccessCallbackResult, + result: ScanCodeSuccessCallbackResult ) => void /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */ type ScrollOffsetCallback = (result: ScrollOffsetCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SeekBackgroundAudioCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type SeekBackgroundAudioFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type SeekBackgroundAudioSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SendCompleteCallback = (res: GeneralCallbackResult) => void @@ -15918,7 +15686,7 @@ wx.writeBLECharacteristicValue({ type SendHCEMessageSuccessCallback = (res: NFCError) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SendSocketMessageCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type SendSocketMessageFailCallback = (res: GeneralCallbackResult) => void @@ -15934,37 +15702,37 @@ wx.writeBLECharacteristicValue({ type SetBGMVolumeSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SetBackgroundColorCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type SetBackgroundColorFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type SetBackgroundColorSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SetBackgroundFetchTokenCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type SetBackgroundFetchTokenFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type SetBackgroundFetchTokenSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SetBackgroundTextStyleCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type SetBackgroundTextStyleFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type SetBackgroundTextStyleSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SetCenterOffsetCompleteCallback = (res: GeneralCallbackResult) => void @@ -15992,13 +15760,13 @@ wx.writeBLECharacteristicValue({ type SetEnableDebugSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SetInnerAudioOptionCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type SetInnerAudioOptionFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type SetInnerAudioOptionSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SetKeepScreenOnCompleteCallback = (res: GeneralCallbackResult) => void @@ -16014,37 +15782,37 @@ wx.writeBLECharacteristicValue({ type SetMICVolumeSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SetNavigationBarColorCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type SetNavigationBarColorFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type SetNavigationBarColorSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SetNavigationBarTitleCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type SetNavigationBarTitleFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type SetNavigationBarTitleSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SetScreenBrightnessCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type SetScreenBrightnessFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type SetScreenBrightnessSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SetStorageCompleteCallback = (res: GeneralCallbackResult) => void @@ -16100,7 +15868,7 @@ wx.writeBLECharacteristicValue({ type ShowActionSheetFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type ShowActionSheetSuccessCallback = ( - result: ShowActionSheetSuccessCallbackResult, + result: ShowActionSheetSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ShowLoadingCompleteCallback = (res: GeneralCallbackResult) => void @@ -16114,19 +15882,19 @@ wx.writeBLECharacteristicValue({ type ShowModalFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type ShowModalSuccessCallback = ( - result: ShowModalSuccessCallbackResult, + result: ShowModalSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ShowNavigationBarLoadingCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type ShowNavigationBarLoadingFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type ShowNavigationBarLoadingSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ShowRedPackageCompleteCallback = (res: GeneralCallbackResult) => void @@ -16158,33 +15926,27 @@ wx.writeBLECharacteristicValue({ type ShowToastFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type ShowToastSuccessCallback = (res: GeneralCallbackResult) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type SocketTaskCloseCompleteCallback = (res: GeneralCallbackResult) => void - /** 接口调用失败的回调函数 */ - type SocketTaskCloseFailCallback = (res: GeneralCallbackResult) => void - /** 接口调用成功的回调函数 */ - type SocketTaskCloseSuccessCallback = (res: GeneralCallbackResult) => void /** WebSocket 连接关闭事件的回调函数 */ type SocketTaskOnCloseCallback = ( - result: SocketTaskOnCloseCallbackResult, + result: SocketTaskOnCloseCallbackResult ) => void /** WebSocket 错误事件的回调函数 */ type SocketTaskOnErrorCallback = ( - result: SocketTaskOnErrorCallbackResult, + result: UDPSocketOnErrorCallbackResult ) => void /** WebSocket 接受到服务器的消息事件的回调函数 */ type SocketTaskOnMessageCallback = ( - result: SocketTaskOnMessageCallbackResult, + result: SocketTaskOnMessageCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StartAccelerometerCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type StartAccelerometerFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type StartAccelerometerSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StartBeaconDiscoveryCompleteCallback = (res: IBeaconError) => void @@ -16194,15 +15956,15 @@ wx.writeBLECharacteristicValue({ type StartBeaconDiscoverySuccessCallback = (res: IBeaconError) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StartBluetoothDevicesDiscoveryCompleteCallback = ( - res: BluetoothError, + res: BluetoothError ) => void /** 接口调用失败的回调函数 */ type StartBluetoothDevicesDiscoveryFailCallback = ( - res: BluetoothError, + res: BluetoothError ) => void /** 接口调用成功的回调函数 */ type StartBluetoothDevicesDiscoverySuccessCallback = ( - res: BluetoothError, + res: BluetoothError ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StartCompassCompleteCallback = (res: GeneralCallbackResult) => void @@ -16211,17 +15973,21 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type StartCompassSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type StartCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StartDeviceMotionListeningCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type StartDeviceMotionListeningFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type StartDeviceMotionListeningSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void + /** 接口调用失败的回调函数 */ + type StartFailCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StartGyroscopeCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ @@ -16236,37 +16002,37 @@ wx.writeBLECharacteristicValue({ type StartHCESuccessCallback = (res: NFCError) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StartLocalServiceDiscoveryCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type StartLocalServiceDiscoveryFailCallback = ( - result: StartLocalServiceDiscoveryFailCallbackResult, + result: StartLocalServiceDiscoveryFailCallbackResult ) => void /** 接口调用成功的回调函数 */ type StartLocalServiceDiscoverySuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StartLocationUpdateBackgroundCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type StartLocationUpdateBackgroundFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type StartLocationUpdateBackgroundSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StartLocationUpdateCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type StartLocationUpdateFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type StartLocationUpdateSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StartPreviewCompleteCallback = (res: GeneralCallbackResult) => void @@ -16276,30 +16042,36 @@ wx.writeBLECharacteristicValue({ type StartPreviewSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StartPullDownRefreshCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type StartPullDownRefreshFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type StartPullDownRefreshSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type StartRecordCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type StartRecordFailCallback = (res: GeneralCallbackResult) => void /** 超过30s或页面 `onHide` 时会结束录像 */ type StartRecordTimeoutCallback = ( - result: StartRecordTimeoutCallbackResult, + result: StartRecordTimeoutCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StartSoterAuthenticationCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type StartSoterAuthenticationFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type StartSoterAuthenticationSuccessCallback = ( - result: StartSoterAuthenticationSuccessCallbackResult, + result: StartSoterAuthenticationSuccessCallbackResult ) => void + /** 接口调用成功的回调函数 */ + type StartSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StartWifiCompleteCallback = (res: WifiError) => void /** 接口调用失败的回调函数 */ @@ -16314,7 +16086,7 @@ wx.writeBLECharacteristicValue({ type StatSuccessCallback = (result: StatSuccessCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StopAccelerometerCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type StopAccelerometerFailCallback = (res: GeneralCallbackResult) => void @@ -16334,13 +16106,13 @@ wx.writeBLECharacteristicValue({ type StopBGMSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StopBackgroundAudioCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type StopBackgroundAudioFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type StopBackgroundAudioSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StopBeaconDiscoveryCompleteCallback = (res: IBeaconError) => void @@ -16350,15 +16122,15 @@ wx.writeBLECharacteristicValue({ type StopBeaconDiscoverySuccessCallback = (res: IBeaconError) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StopBluetoothDevicesDiscoveryCompleteCallback = ( - res: BluetoothError, + res: BluetoothError ) => void /** 接口调用失败的回调函数 */ type StopBluetoothDevicesDiscoveryFailCallback = ( - res: BluetoothError, + res: BluetoothError ) => void /** 接口调用成功的回调函数 */ type StopBluetoothDevicesDiscoverySuccessCallback = ( - res: BluetoothError, + res: BluetoothError ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StopCompassCompleteCallback = (res: GeneralCallbackResult) => void @@ -16367,17 +16139,21 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type StopCompassSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type StopCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StopDeviceMotionListeningCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type StopDeviceMotionListeningFailCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用成功的回调函数 */ type StopDeviceMotionListeningSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void + /** 接口调用失败的回调函数 */ + type StopFailCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StopGyroscopeCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ @@ -16392,25 +16168,25 @@ wx.writeBLECharacteristicValue({ type StopHCESuccessCallback = (res: NFCError) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StopLocalServiceDiscoveryCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type StopLocalServiceDiscoveryFailCallback = ( - result: StopLocalServiceDiscoveryFailCallbackResult, + result: StopLocalServiceDiscoveryFailCallbackResult ) => void /** 接口调用成功的回调函数 */ type StopLocalServiceDiscoverySuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StopLocationUpdateCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type StopLocationUpdateFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type StopLocationUpdateSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StopPreviewCompleteCallback = (res: GeneralCallbackResult) => void @@ -16420,15 +16196,21 @@ wx.writeBLECharacteristicValue({ type StopPreviewSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StopPullDownRefreshCompleteCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用失败的回调函数 */ type StopPullDownRefreshFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type StopPullDownRefreshSuccessCallback = ( - res: GeneralCallbackResult, + res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type StopRecordCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type StopRecordFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type StopSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type StopVoiceCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type StopVoiceFailCallback = (res: GeneralCallbackResult) => void @@ -16458,7 +16240,7 @@ wx.writeBLECharacteristicValue({ type TakePhotoFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type TakePhotoSuccessCallback = ( - result: TakePhotoSuccessCallbackResult, + result: TakePhotoSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ToggleTorchCompleteCallback = (res: GeneralCallbackResult) => void @@ -16475,16 +16257,18 @@ wx.writeBLECharacteristicValue({ /** 关闭事件的回调函数 */ type UDPSocketOffCloseCallback = (res: GeneralCallbackResult) => void /** 错误事件的回调函数 */ - type UDPSocketOffErrorCallback = (res: GeneralCallbackResult) => void + type UDPSocketOffErrorCallback = ( + result: UDPSocketOnErrorCallbackResult + ) => void /** 关闭事件的回调函数 */ type UDPSocketOnCloseCallback = (res: GeneralCallbackResult) => void /** 错误事件的回调函数 */ type UDPSocketOnErrorCallback = ( - result: UDPSocketOnErrorCallbackResult, + result: UDPSocketOnErrorCallbackResult ) => void /** 收到消息的事件的回调函数 */ type UDPSocketOnMessageCallback = ( - result: UDPSocketOnMessageCallbackResult, + result: UDPSocketOnMessageCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type UndoCompleteCallback = (res: GeneralCallbackResult) => void @@ -16516,23 +16300,23 @@ wx.writeBLECharacteristicValue({ type UploadFileFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type UploadFileSuccessCallback = ( - result: UploadFileSuccessCallbackResult, + result: UploadFileSuccessCallbackResult ) => void /** HTTP Response Header 事件的回调函数 */ type UploadTaskOffHeadersReceivedCallback = ( - res: GeneralCallbackResult, + result: OnHeadersReceivedCallbackResult ) => void /** 上传进度变化事件的回调函数 */ type UploadTaskOffProgressUpdateCallback = ( - res: GeneralCallbackResult, + result: UploadTaskOnProgressUpdateCallbackResult ) => void /** HTTP Response Header 事件的回调函数 */ type UploadTaskOnHeadersReceivedCallback = ( - result: UploadTaskOnHeadersReceivedCallbackResult, + result: OnHeadersReceivedCallbackResult ) => void /** 上传进度变化事件的回调函数 */ type UploadTaskOnProgressUpdateCallback = ( - result: UploadTaskOnProgressUpdateCallbackResult, + result: UploadTaskOnProgressUpdateCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type VibrateLongCompleteCallback = (res: GeneralCallbackResult) => void @@ -16548,17 +16332,17 @@ wx.writeBLECharacteristicValue({ type VibrateShortSuccessCallback = (res: GeneralCallbackResult) => void /** 主线程/Worker 线程向当前线程发送的消息的事件的回调函数 */ type WorkerOnMessageCallback = ( - result: WorkerOnMessageCallbackResult, + result: WorkerOnMessageCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type WriteBLECharacteristicValueCompleteCallback = ( - res: BluetoothError, + res: BluetoothError ) => void /** 接口调用失败的回调函数 */ type WriteBLECharacteristicValueFailCallback = (res: BluetoothError) => void /** 接口调用成功的回调函数 */ type WriteBLECharacteristicValueSuccessCallback = ( - res: BluetoothError, + res: BluetoothError ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type WriteFileCompleteCallback = (res: GeneralCallbackResult) => void @@ -16566,52 +16350,28 @@ wx.writeBLECharacteristicValue({ type WriteFileFailCallback = (result: WriteFileFailCallbackResult) => void /** 接口调用成功的回调函数 */ type WriteFileSuccessCallback = (res: GeneralCallbackResult) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type WxGetFileInfoCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type WxGetFileInfoFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type WxGetFileInfoSuccessCallback = ( - result: WxGetFileInfoSuccessCallbackResult, - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type WxGetSavedFileListCompleteCallback = ( - res: GeneralCallbackResult, + result: WxGetFileInfoSuccessCallbackResult ) => void - /** 接口调用失败的回调函数 */ - type WxGetSavedFileListFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type WxGetSavedFileListSuccessCallback = ( - result: WxGetSavedFileListSuccessCallbackResult, - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type WxRemoveSavedFileCompleteCallback = ( - res: GeneralCallbackResult, + result: WxGetSavedFileListSuccessCallbackResult ) => void /** 接口调用失败的回调函数 */ type WxRemoveSavedFileFailCallback = (res: GeneralCallbackResult) => void - /** 接口调用成功的回调函数 */ - type WxRemoveSavedFileSuccessCallback = (res: GeneralCallbackResult) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type WxSaveFileCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type WxSaveFileFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type WxSaveFileSuccessCallback = ( - result: WxSaveFileSuccessCallbackResult, + result: WxSaveFileSuccessCallbackResult ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type WxStartRecordCompleteCallback = (res: GeneralCallbackResult) => void - /** 接口调用失败的回调函数 */ - type WxStartRecordFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type WxStartRecordSuccessCallback = ( - result: StartRecordSuccessCallbackResult, + result: StartRecordSuccessCallbackResult ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type WxStopRecordCompleteCallback = (res: GeneralCallbackResult) => void - /** 接口调用失败的回调函数 */ - type WxStopRecordFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type WxStopRecordSuccessCallback = (res: GeneralCallbackResult) => void } @@ -16626,7 +16386,14 @@ declare let exports: any * 取消由 setInterval 设置的定时器。 */ declare function clearInterval( /** 要取消的定时器的 ID */ - intervalID: number, + intervalID: number +): void +/** [clearTimeout(number timeoutID)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/clearTimeout.html) + * + * 取消由 setTimeout 设置的定时器。 */ +declare function clearTimeout( + /** 要取消的定时器的 ID */ + timeoutID: number ): void /** [number setInterval(function callback, number delay, any rest)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/setInterval.html) * @@ -16637,15 +16404,8 @@ declare function setInterval( /** 执行回调函数之间的时间间隔,单位 ms。 */ delay?: number, /** param1, param2, ..., paramN 等附加参数,它们会作为参数传递给回调函数。 */ - rest?: any, + rest?: any ): number -/** [clearTimeout(number timeoutID)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/clearTimeout.html) - * - * 取消由 setTimeout 设置的定时器。 */ -declare function clearTimeout( - /** 要取消的定时器的 ID */ - timeoutID: number, -): void /** [number setTimeout(function callback, number delay, any rest)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/setTimeout.html) * * 设定一个定时器。在定时到期以后执行注册的回调函数 */ @@ -16655,5 +16415,5 @@ declare function setTimeout( /** 延迟的时间,函数的调用会在该延迟之后发生,单位 ms。 */ delay?: number, /** param1, param2, ..., paramN 等附加参数,它们会作为参数传递给回调函数。 */ - rest?: any, + rest?: any ): number diff --git a/types/wx/lib.wx.behavior.d.ts b/types/wx/lib.wx.behavior.d.ts index e5fcea1..63200c8 100644 --- a/types/wx/lib.wx.behavior.d.ts +++ b/types/wx/lib.wx.behavior.d.ts @@ -45,7 +45,7 @@ declare namespace WechatMiniprogram { TProperty extends PropertyOption, TMethod extends MethodOption >( - options: Options, + options: Options ): string } diff --git a/types/wx/lib.wx.cloud.d.ts b/types/wx/lib.wx.cloud.d.ts index f2f7e73..12b6395 100644 --- a/types/wx/lib.wx.cloud.d.ts +++ b/types/wx/lib.wx.cloud.d.ts @@ -53,7 +53,7 @@ interface IInitCloudConfig { | { database?: string functions?: string - storage?: string, + storage?: string } traceUser?: boolean } @@ -100,29 +100,29 @@ interface WxCloud { callFunction(param: OQ): void callFunction( - param: RQ, + param: RQ ): Promise uploadFile(param: OQ): WechatMiniprogram.UploadTask uploadFile( - param: RQ, + param: RQ ): Promise downloadFile( - param: OQ, + param: OQ ): WechatMiniprogram.DownloadTask downloadFile( - param: RQ, + param: RQ ): Promise getTempFileURL(param: OQ): void getTempFileURL( - param: RQ, + param: RQ ): Promise deleteFile(param: OQ): void deleteFile( - param: RQ, + param: RQ ): Promise database: (config?: ICloudConfig) => DB.Database @@ -248,12 +248,12 @@ declare namespace DB { update(options: OQ): void update( - options?: RQ, + options?: RQ ): Promise remove(options: OQ): void remove( - options?: RQ, + options?: RQ ): Promise watch(options: IWatchOptions): RealtimeListener @@ -297,7 +297,7 @@ declare namespace DB { geoNear(options: IGeoNearCommandOptions): DatabaseQueryCommand geoWithin(options: IGeoWithinCommandOptions): DatabaseQueryCommand geoIntersects( - options: IGeoIntersectsCommandOptions, + options: IGeoIntersectsCommandOptions ): DatabaseQueryCommand and( @@ -337,7 +337,7 @@ declare namespace DB { pullAll(val: any): DatabaseUpdateCommand project: { - slice(val: number | [number, number]): DatabaseProjectionCommand, + slice(val: number | [number, number]): DatabaseProjectionCommand } aggregate: { @@ -448,7 +448,7 @@ declare namespace DB { type(val: any): DatabaseAggregateCommand week(val: any): DatabaseAggregateCommand year(val: any): DatabaseAggregateCommand - zip(val: any): DatabaseAggregateCommand, + zip(val: any): DatabaseAggregateCommand } } @@ -513,7 +513,7 @@ declare namespace DB { geoNear(options: IGeoNearCommandOptions): DatabaseLogicCommand geoWithin(options: IGeoWithinCommandOptions): DatabaseLogicCommand geoIntersects( - options: IGeoIntersectsCommandOptions, + options: IGeoIntersectsCommandOptions ): DatabaseLogicCommand } @@ -588,10 +588,10 @@ declare namespace DB { interface IGeoMultiLineStringConstructor { new ( - lineStrings: GeoLineString[] | IGeoJSONMultiLineString, + lineStrings: GeoLineString[] | IGeoJSONMultiLineString ): GeoMultiLineString ( - lineStrings: GeoLineString[] | IGeoJSONMultiLineString, + lineStrings: GeoLineString[] | IGeoJSONMultiLineString ): GeoMultiLineString } @@ -855,7 +855,7 @@ declare namespace DB { interface IUpdateResult extends IAPISuccessParam { stats: { - updated: number, + updated: number // created: number, } } @@ -864,13 +864,13 @@ declare namespace DB { _id: DocumentId stats: { updated: number - created: number, + created: number } } interface IRemoveResult extends IAPISuccessParam { stats: { - removed: number, + removed: number } } diff --git a/types/wx/lib.wx.component.d.ts b/types/wx/lib.wx.component.d.ts index e3ee364..837a30c 100644 --- a/types/wx/lib.wx.component.d.ts +++ b/types/wx/lib.wx.component.d.ts @@ -32,7 +32,7 @@ declare namespace WechatMiniprogram { /** 组件数据,**包括内部数据和属性值** */ data: TData & PropertyOptionToData /** 组件数据,**包括内部数据和属性值**(与 `data` 一致) */ - properties: TData & PropertyOptionToData, + properties: TData & PropertyOptionToData } type TrivialInstance = Instance type TrivialOption = Options @@ -52,7 +52,7 @@ declare namespace WechatMiniprogram { TProperty extends PropertyOption, TMethod extends MethodOption >( - options: Options, + options: Options ): string } type DataOption = Record @@ -81,13 +81,15 @@ declare namespace WechatMiniprogram { type ValueType = T extends StringConstructor ? string : T extends NumberConstructor - ? number - : T extends BooleanConstructor - ? boolean - : T extends ArrayConstructor - ? any[] - : T extends ObjectConstructor ? IAnyObject : any - interface FullProperty { + ? number + : T extends BooleanConstructor + ? boolean + : T extends ArrayConstructor + ? any[] + : T extends ObjectConstructor + ? IAnyObject + : any + type FullProperty = { /** 属性类型 */ type: T /** 属性初始值 */ @@ -98,7 +100,7 @@ declare namespace WechatMiniprogram { | (( newVal: ValueType, oldVal: ValueType, - changedPath: Array, + changedPath: Array ) => void) /** 属性的类型(可以指定多个) */ optionalTypes?: ShortProperty[] @@ -157,7 +159,7 @@ declare namespace WechatMiniprogram { */ data: Partial & IAnyObject, /** setData引起的界面更新渲染完毕后的回调函数,最低基础库: `1.5.0` */ - callback?: () => void, + callback?: () => void ): void /** 检查组件是否具有 `behavior` (检查时会递归检查被直接或间接引入的所有behavior) */ @@ -166,13 +168,13 @@ declare namespace WechatMiniprogram { triggerEvent( name: string, detail?: object, - options?: TriggerEventOption, + options?: TriggerEventOption ): void /** 创建一个 SelectorQuery 对象,选择器选取范围为这个组件实例内 */ createSelectorQuery(): SelectorQuery /** 创建一个 IntersectionObserver 对象,选择器选取范围为这个组件实例内 */ createIntersectionObserver( - options: CreateIntersectionObserverOption, + options: CreateIntersectionObserverOption ): IntersectionObserver /** 使用选择器选择组件实例节点,返回匹配到的第一个组件实例对象(会被 `wx://component-export` 影响) */ selectComponent(selector: string): TrivialInstance @@ -213,7 +215,7 @@ declare namespace WechatMiniprogram { selector: string, keyFrames: KeyFrame[], duration: number, - callback: () => void, + callback: () => void ): void /** * 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) @@ -224,7 +226,7 @@ declare namespace WechatMiniprogram { selector: string, keyFrames: ScrollTimelineKeyframe[], duration: number, - scrollTimeline: ScrollTimelineOption, + scrollTimeline: ScrollTimelineOption ): void /** * 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) @@ -240,7 +242,7 @@ declare namespace WechatMiniprogram { clearAnimation( selector: string, options: ClearAnimationOptions, - callback: () => void, + callback: () => void ): void getOpenerEventChannel(): EventChannel } @@ -323,7 +325,7 @@ declare namespace WechatMiniprogram { /** 使用该 behavior 的 component/behavior 的定义对象 */ defFields: T, /** 该 behavior 所使用的 behavior 的 definitionFilter 函数列表 */ - definitionFilterArr?: DefinitionFilter[], + definitionFilterArr?: DefinitionFilter[] ) => void interface Lifetimes { @@ -366,7 +368,7 @@ declare namespace WechatMiniprogram { * * 最低基础库版本:[`2.4.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) */ - error(err: Error): void, + error(err: Error): void }> /** * @deprecated 旧式的定义方式,基础库 `2.2.3` 起请在 lifetimes 中定义 @@ -429,7 +431,7 @@ declare namespace WechatMiniprogram { observers: Record any> /** 组件间关系定义,参见 [组件间关系](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/lifetimes.html) */ relations: { - [componentName: string]: RelationOption, + [componentName: string]: RelationOption } /** 组件接受的外部样式类,参见 [外部样式类](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html) */ externalClasses?: string[] diff --git a/types/wx/lib.wx.event.d.ts b/types/wx/lib.wx.event.d.ts index 7aedae9..dc672bb 100644 --- a/types/wx/lib.wx.event.d.ts +++ b/types/wx/lib.wx.event.d.ts @@ -1,3 +1,25 @@ +/*! ***************************************************************************** +Copyright (c) 2020 Tencent, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +***************************************************************************** */ + declare namespace WechatMiniprogram { interface Touch { clientX: number @@ -9,19 +31,19 @@ declare namespace WechatMiniprogram { } interface Event { currentTarget: { - id: string, + id: string dataset: { [key: string]: string - }, - offsetTop: number, + } + offsetTop: number offsetLeft: number } target: { - id: string, + id: string dataset: { [key: string]: string - }, - offsetTop: number, + } + offsetTop: number offsetLeft: number } timeStamp: number @@ -32,10 +54,10 @@ declare namespace WechatMiniprogram { interface TapEvent extends Event { changedTouches: [] detail: { - x: number, + x: number y: number } - type: "tap" + type: 'tap' } interface InputEvent extends Event { @@ -45,9 +67,6 @@ declare namespace WechatMiniprogram { keyCode: number value: string } - type: "input" + type: 'input' } } - - - diff --git a/types/wx/lib.wx.page.d.ts b/types/wx/lib.wx.page.d.ts index 8b0743e..55e1084 100644 --- a/types/wx/lib.wx.page.d.ts +++ b/types/wx/lib.wx.page.d.ts @@ -38,7 +38,7 @@ declare namespace WechatMiniprogram { type TrivialInstance = Instance interface Constructor { ( - options: Options, + options: Options ): void } interface ILifetime { @@ -48,7 +48,7 @@ declare namespace WechatMiniprogram { */ onLoad( /** 打开当前页面路径中的参数 */ - query: Record, + query: Record ): void /** 生命周期回调—监听页面显示 * @@ -98,7 +98,7 @@ declare namespace WechatMiniprogram { */ onShareAppMessage( /** 分享发起来源参数 */ - options: IShareAppMessageOption, + options: IShareAppMessageOption ): ICustomShareContent /** 页面滚动触发事件的处理函数 * @@ -106,19 +106,19 @@ declare namespace WechatMiniprogram { */ onPageScroll( /** 页面滚动参数 */ - options: IPageScrollOption, + options: IPageScrollOption ): void /** 当前是 tab 页时,点击 tab 时触发,最低基础库: `1.9.0` */ onTabItemTap( /** tab 点击参数 */ - options: ITabItemTapOption, + options: ITabItemTapOption ): void /** 窗口尺寸改变时触发,最低基础库:`2.4.0` */ onResize( /** 窗口尺寸参数 */ - options: IResizeOption, + options: IResizeOption ): void } interface InstanceProperties { @@ -200,7 +200,7 @@ declare namespace WechatMiniprogram { /** 变化后的窗口宽度,单位 px */ windowWidth: number /** 变化后的窗口高度,单位 px */ - windowHeight: number, + windowHeight: number } } From 348b1713b9537909a727836374e301121d1a86a7 Mon Sep 17 00:00:00 2001 From: SgLy <775150558@qq.com> Date: Thu, 21 May 2020 15:40:10 +0800 Subject: [PATCH 017/205] feat(baselib): definition for 2.11.0 --- CHANGELOG.md | 5 + VERSIONS.md | 1 + package-lock.json | 2 +- package.json | 2 +- types/wx/lib.wx.api.d.ts | 925 ++++++++++++++++++++++++++++++++------- 5 files changed, 778 insertions(+), 157 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c055912..0bb7137 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2020-05-20 v2.11.0 +- 同步 API 定义到基础库 2.11.0 +- 该版本继续合并了一部分完全相同的 interface / callback,是一个 **破坏性改动**,原本字面上引用了这些 interface / callback 的代码可能会报错。 +- 修复接口错误 ([#126](https://github.com/wechat-miniprogram/api-typings/issues/126)) + ## 2020-04-20 v2.10.4 - 同步 API 定义到基础库 2.10.4 - 在之前的版本中,分属于不同接口的两个 interface / callback 即使完全相同,也会拥有不同的名字。在这次更新中,他们将合并为同一个(如 `FileSystemManagerGetFileInfoCompleteCallback` 和 `WxGetFileInfoCompleteCallback` 都变成了 `GetFileInfoCompleteCallback`)。这是一个 **破坏性改动**,原本字面上引用了这些 interface / callback 的代码可能会报错。 diff --git a/VERSIONS.md b/VERSIONS.md index 2fdb234..2163489 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -2,6 +2,7 @@ 基础库版本|npm 版本|命令 -|-|- +[v2.11.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-11-0-2020-04-24) | [2.11.0](https://www.npmjs.com/package/miniprogram-api-typings/v/2.11.0) | `npm install miniprogram-api-typings@2.11.0` [v2.10.4](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-4-2020-03-24) | [2.10.4](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.4) | `npm install miniprogram-api-typings@2.10.4` [v2.10.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-3-2020-03-06) | [2.10.3-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.3-1) | `npm install miniprogram-api-typings@2.10.3-1` [v2.10.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-2-2020-02-20) | [2.10.2-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.2-1) | `npm install miniprogram-api-typings@2.10.2-1` diff --git a/package-lock.json b/package-lock.json index 0712125..f46a5e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.10.4", + "version": "2.11.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 528f54f..1d72763 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.10.4", + "version": "2.11.0", "description": "Type definitions for APIs of Wechat Mini Program in TypeScript", "main": "./index.d.ts", "types": "./index.d.ts", diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index e9063a6..e77e7c7 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -331,6 +331,10 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb epname: string /** 当前是否暂停或停止。(只读) */ paused: boolean + /** 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本) + * + * 最低基础库: `2.11.0` */ + playbackRate: number /** 音频协议。默认值为 'http',设置 'hls' 可以支持播放 HLS 协议的直播音频。 * * 最低基础库: `1.9.94` */ @@ -439,14 +443,6 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 接口调用成功的回调函数 */ success?: StartSuccessCallback } - interface CameraFrameListenerStopOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: StopCompleteCallback - /** 接口调用失败的回调函数 */ - fail?: StopFailCallback - /** 接口调用成功的回调函数 */ - success?: StopSuccessCallback - } /** Canvas 实例,可通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取。 * * **示例代码** @@ -1190,6 +1186,36 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb tempFilePath: string errMsg: string } + interface CompressVideoOption { + /** 码率,单位 kbps */ + bitrate: number + /** 帧率 */ + fps: number + /** 压缩质量 + * + * 可选值: + * - 'low': 低; + * - 'medium': 中; + * - 'high': 高; */ + quality: 'low' | 'medium' | 'high' + /** 相对于原视频的分辨率比例,取值范围(0, 1] */ + resolution: number + /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */ + src: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CompressVideoCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: CompressVideoFailCallback + /** 接口调用成功的回调函数 */ + success?: CompressVideoSuccessCallback + } + interface CompressVideoSuccessCallbackResult { + /** 压缩后的大小,单位 kB */ + size: string + /** 压缩后的临时文件地址 */ + tempFilePath: string + errMsg: string + } interface ConnectSocketOption { /** 开发者服务器 wss 接口地址 */ url: string @@ -1299,6 +1325,16 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 广告单元 id */ adUnitId: string } + interface CreateMediaRecorderOption { + /** 指定录制的时长(s),到达自动停止。最大 7200,最小 5 */ + duration?: number + /** 视频 fps */ + fps?: number + /** 视频关键帧间隔 */ + gop?: number + /** 视频比特率(kbps),最小值 600,最大值 3000 */ + videoBitsPerSecond?: number + } interface CreateRewardedVideoAdOption { /** 广告单元 id */ adUnitId: string @@ -1369,16 +1405,69 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb interface DownloadFileSuccessCallbackResult { /** 用户文件路径 (本地路径)。传入 filePath 时会返回,跟传入的 filePath 一致 */ filePath: string - /** 网络请求过程中一些关键时间点的耗时信息 + /** 网络请求过程中一些调试信息 * * 最低基础库: `2.10.4` */ - profile: IAnyObject + profile: DownloadProfile /** 开发者服务器返回的 HTTP 状态码 */ statusCode: number /** 临时文件路径 (本地路径)。没传入 filePath 指定文件存储路径时会返回,下载后的文件会存储到一个临时文件 */ tempFilePath: string errMsg: string } + /** 网络请求过程中一些调试信息 + * + * 最低基础库: `2.10.4` */ + interface DownloadProfile { + /** SSL建立完成的时间,如果不是安全连接,则值为 0 */ + SSLconnectionEnd: number + /** SSL建立连接的时间,如果不是安全连接,则值为 0 */ + SSLconnectionStart: number + /** HTTP(TCP) 完成建立连接的时间(完成握手),如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接完成的时间。注意这里握手结束,包括安全连接建立完成、SOCKS 授权通过 */ + connectEnd: number + /** HTTP(TCP) 开始建立连接的时间,如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接开始的时间 */ + connectStart: number + /** DNS 域名查询完成的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */ + domainLookupEnd: number + /** DNS 域名查询开始的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */ + domainLookupStart: number + /** 评估当前网络下载的kbps */ + downstreamThroughputKbpsEstimate: number + /** 评估的网络状态 slow 2g/2g/3g/4g */ + estimate_nettype: string + /** 组件准备好使用 HTTP 请求抓取资源的时间,这发生在检查本地缓存之前 */ + fetchStart: number + /** 协议层根据多个请求评估当前网络的 rtt(仅供参考) */ + httpRttEstimate: number + /** 当前请求的IP */ + peerIP: string + /** 当前请求的端口 */ + port: number + /** 收到字节数 */ + receivedBytedCount: number + /** 最后一个 HTTP 重定向完成时的时间。有跳转且是同域名内部的重定向才算,否则值为 0 */ + redirectEnd: number + /** 第一个 HTTP 重定向发生时的时间。有跳转且是同域名内的重定向才算,否则值为 0 */ + redirectStart: number + /** HTTP请求读取真实文档结束的时间 */ + requestEnd: number + /** HTTP请求读取真实文档开始的时间(完成建立连接),包括从本地读取缓存。连接错误重连时,这里显示的也是新建立连接的时间 */ + requestStart: number + /** HTTP 响应全部接收完成的时间(获取到最后一个字节),包括从本地读取缓存 */ + responseEnd: number + /** HTTP 开始接收响应的时间(获取到第一个字节),包括从本地读取缓存 */ + responseStart: number + /** 当次请求连接过程中实时 rtt */ + rtt: number + /** 发送的字节数 */ + sendBytesCount: number + /** 是否复用连接 */ + socketReused: boolean + /** 当前网络的实际下载kbps */ + throughputKbps: number + /** 传输层根据多个请求评估的当前网络的 rtt(仅供参考) */ + transportRttEstimate: number + } interface DownloadTaskOnProgressUpdateCallbackResult { /** 下载进度百分比 */ progress: number @@ -1395,6 +1484,14 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 接口调用成功的回调函数 */ success?: ExitFullScreenSuccessCallback } + interface ExitPictureInPictureOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ExitPictureInPictureCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ExitPictureInPictureFailCallback + /** 接口调用成功的回调函数 */ + success?: ExitPictureInPictureSuccessCallback + } interface ExtractDataSourceOption { /** 视频源地址,只支持本地文件 */ source: string @@ -1538,6 +1635,21 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb characteristics: BLECharacteristic[] errMsg: string } + interface GetBLEDeviceRSSIOption { + /** 蓝牙设备 id */ + deviceId: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetBLEDeviceRSSICompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetBLEDeviceRSSIFailCallback + /** 接口调用成功的回调函数 */ + success?: GetBLEDeviceRSSISuccessCallback + } + interface GetBLEDeviceRSSISuccessCallbackResult { + /** 信号强度 */ + RSSI: number + errMsg: string + } interface GetBLEDeviceServicesOption { /** 蓝牙设备 id */ deviceId: string @@ -2188,6 +2300,10 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb statusBarHeight: number /** 操作系统及版本 */ system: string + /** 系统当前主题,取值为`light`或`dark`,全局配置`"darkmode":true`时才能获取,否则为 undefined (不支持小游戏) + * + * 最低基础库: `2.11.0` */ + theme: string /** 微信版本号 */ version: string /** Wi-Fi 的系统开关 @@ -2283,6 +2399,10 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb statusBarHeight: number /** 操作系统及版本 */ system: string + /** 系统当前主题,取值为`light`或`dark`,全局配置`"darkmode":true`时才能获取,否则为 undefined (不支持小游戏) + * + * 最低基础库: `2.11.0` */ + theme: string /** 微信版本号 */ version: string /** Wi-Fi 的系统开关 @@ -2330,6 +2450,53 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb userInfo: UserInfo errMsg: string } + interface GetVideoInfoOption { + /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */ + src: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetVideoInfoCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetVideoInfoFailCallback + /** 接口调用成功的回调函数 */ + success?: GetVideoInfoSuccessCallback + } + interface GetVideoInfoSuccessCallbackResult { + /** 视频码率,单位 kbps */ + bitrate: number + /** 视频长度 */ + duration: number + /** 视频帧率 */ + fps: number + /** 视频的长,单位 px */ + height: number + /** 画面方向 + * + * 可选值: + * - 'up': 默认; + * - 'down': 180度旋转; + * - 'left': 逆时针旋转90度; + * - 'right': 顺时针旋转90度; + * - 'up-mirrored': 同up,但水平翻转; + * - 'down-mirrored': 同down,但水平翻转; + * - 'left-mirrored': 同left,但垂直翻转; + * - 'right-mirrored': 同right,但垂直翻转; */ + orientation: + | 'up' + | 'down' + | 'left' + | 'right' + | 'up-mirrored' + | 'down-mirrored' + | 'left-mirrored' + | 'right-mirrored' + /** 视频大小,单位 kB */ + size: number + /** 视频格式 */ + type: string + /** 视频的宽,单位 px */ + width: number + errMsg: string + } interface GetWeRunDataOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: GetWeRunDataCompleteCallback @@ -2449,7 +2616,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb onerror: (...args: any[]) => any /** 图片加载完成后触发的回调函数 */ onload: (...args: any[]) => any - /** 图片的 URL */ + /** 图片的 URL。v2.11.0 起支持传递 base64 Data URI */ src: string /** 图片的真实宽度 */ width: number @@ -2536,6 +2703,10 @@ innerAudioContext.onError((res) => { obeyMuteSwitch: boolean /** 当前是是否暂停或停止状态(只读) */ paused: boolean + /** 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本) + * + * 最低基础库: `2.11.0` */ + playbackRate: number /** 音频资源的地址,用于直接播放。[2.2.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 开始支持云文件ID */ src: string /** 开始播放的位置(单位:s),默认为 0 */ @@ -2638,15 +2809,7 @@ innerAudioContext.onError((res) => { /** 启动小程序的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */ scene: number /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */ - shareTicket: string - } - interface LivePlayerContextPauseOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: PauseCompleteCallback - /** 接口调用失败的回调函数 */ - fail?: PauseFailCallback - /** 接口调用成功的回调函数 */ - success?: PauseSuccessCallback + shareTicket?: string } interface LivePlayerContextRequestFullScreenOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ @@ -2663,54 +2826,6 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: RequestFullScreenSuccessCallback } - interface LivePlayerContextResumeOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: ResumeCompleteCallback - /** 接口调用失败的回调函数 */ - fail?: ResumeFailCallback - /** 接口调用成功的回调函数 */ - success?: ResumeSuccessCallback - } - interface LivePlayerContextStopOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: StopCompleteCallback - /** 接口调用失败的回调函数 */ - fail?: StopFailCallback - /** 接口调用成功的回调函数 */ - success?: StopSuccessCallback - } - interface LivePusherContextPauseOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: PauseCompleteCallback - /** 接口调用失败的回调函数 */ - fail?: PauseFailCallback - /** 接口调用成功的回调函数 */ - success?: PauseSuccessCallback - } - interface LivePusherContextResumeOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: ResumeCompleteCallback - /** 接口调用失败的回调函数 */ - fail?: ResumeFailCallback - /** 接口调用成功的回调函数 */ - success?: ResumeSuccessCallback - } - interface LivePusherContextStartOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: StartCompleteCallback - /** 接口调用失败的回调函数 */ - fail?: StartFailCallback - /** 接口调用成功的回调函数 */ - success?: StartSuccessCallback - } - interface LivePusherContextStopOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: StopCompleteCallback - /** 接口调用失败的回调函数 */ - fail?: StopFailCallback - /** 接口调用成功的回调函数 */ - success?: StopSuccessCallback - } interface LoadFontFaceCompleteCallbackResult { /** 加载字体结果 */ status: string @@ -2974,27 +3089,6 @@ innerAudioContext.onError((res) => { /** 相交检测时的时间戳 */ time: number } - interface OffAppShowCallbackResult { - /** 小程序切前台的路径 (代码包路径) */ - path: string - /** 小程序切前台的 query 参数 */ - query: IAnyObject - /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */ - referrerInfo: ReferrerInfo - /** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */ - scene: number - /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */ - shareTicket: string - } - interface OffMessageCallbackResult { - /** 收到的消息 */ - message: ArrayBuffer - /** 消息来源的结构化信息 */ - remoteInfo: RemoteInfo - } - interface OffWindowResizeCallbackResult { - size: Size - } interface OnAccelerometerChangeCallbackResult { /** X 轴 */ x: number @@ -3013,7 +3107,7 @@ innerAudioContext.onError((res) => { /** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */ scene: number /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */ - shareTicket: string + shareTicket?: string } interface OnBLECharacteristicValueChangeCallbackResult { /** 蓝牙特征值的 uuid */ @@ -3217,10 +3311,10 @@ innerAudioContext.onError((res) => { * * 最低基础库: `2.0.0` */ header: IAnyObject - /** 网络请求过程中一些关键时间点的耗时信息 + /** 网络请求过程中一些调试信息 * * 最低基础库: `2.10.4` */ - profile: IAnyObject + profile: SocketProfile } interface OnPageNotFoundCallbackResult { /** 是否本次启动的首个页面(例如从分享等入口进来,首个页面是开发者配置的分享页面) */ @@ -3244,6 +3338,10 @@ innerAudioContext.onError((res) => { /** 录音文件的临时路径 (本地路径) */ tempFilePath: string } + interface OnThemeChangeCallbackResult { + /** 系统当前的主题,取值为`light`或`dark` */ + theme: string + } interface OnUnhandledRejectionCallbackResult { /** 被拒绝的 Promise 对象 */ promise: Promise @@ -3265,9 +3363,13 @@ innerAudioContext.onError((res) => { /** 接口调用失败的回调函数 */ fail?: OpenBluetoothAdapterFailCallback /** 蓝牙模式,可作为主/从设备,仅 iOS 需要。 + * + * 可选值: + * - 'central': 主机模式; + * - 'peripheral': 丛机模式; * * 最低基础库: `2.10.0` */ - mode?: string + mode?: 'central' | 'peripheral' /** 接口调用成功的回调函数 */ success?: OpenBluetoothAdapterSuccessCallback } @@ -3308,7 +3410,9 @@ innerAudioContext.onError((res) => { * * 最低基础库: `1.4.0` */ fileType?: 'doc' | 'docx' | 'xls' | 'xlsx' | 'ppt' | 'pptx' | 'pdf' - /** 是否显示右上角菜单 */ + /** 是否显示右上角菜单 + * + * 最低基础库: `2.11.0` */ showMenu?: boolean /** 接口调用成功的回调函数 */ success?: OpenDocumentSuccessCallback @@ -3374,6 +3478,10 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: PageScrollToSuccessCallback } + /** Canvas 2D API 的接口 Path2D 用来声明路径,此路径稍后会被CanvasRenderingContext2D 对象使用。CanvasRenderingContext2D 接口的 路径方法 也存在于 Path2D 这个接口中,允许你在 canvas 中根据需要创建可以保留并重用的路径。 + * + * 最低基础库: `2.11.0` */ + interface Path2D {} interface PauseBGMOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: PauseBGMCompleteCallback @@ -3390,6 +3498,14 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: PauseBackgroundAudioSuccessCallback } + interface PauseOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PauseCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: PauseFailCallback + /** 接口调用成功的回调函数 */ + success?: PauseSuccessCallback + } interface PauseVoiceOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: PauseVoiceCompleteCallback @@ -3398,6 +3514,13 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: PauseVoiceSuccessCallback } + /** PerformanceObserver 对象, 用于监听性能相关事件 + * + * 最低基础库: `2.11.0` */ + interface PerformanceObserver { + /** 获取当前支持的所有性能指标类型 */ + supportedEntryTypes: any[] + } interface PlayBGMOption { /** 加入背景混音的资源地址 */ url: string @@ -3862,6 +3985,59 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: RequestPaymentSuccessCallback } + /** 网络请求过程中一些调试信息 + * + * 最低基础库: `2.10.4` */ + interface RequestProfile { + /** SSL建立完成的时间,如果不是安全连接,则值为 0 */ + SSLconnectionEnd: number + /** SSL建立连接的时间,如果不是安全连接,则值为 0 */ + SSLconnectionStart: number + /** HTTP(TCP) 完成建立连接的时间(完成握手),如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接完成的时间。注意这里握手结束,包括安全连接建立完成、SOCKS 授权通过 */ + connectEnd: number + /** HTTP(TCP) 开始建立连接的时间,如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接开始的时间 */ + connectStart: number + /** DNS 域名查询完成的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */ + domainLookupEnd: number + /** DNS 域名查询开始的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */ + domainLookupStart: number + /** 评估当前网络下载的kbps */ + downstreamThroughputKbpsEstimate: number + /** 评估的网络状态 slow 2g/2g/3g/4g */ + estimate_nettype: string + /** 组件准备好使用 HTTP 请求抓取资源的时间,这发生在检查本地缓存之前 */ + fetchStart: number + /** 协议层根据多个请求评估当前网络的 rtt(仅供参考) */ + httpRttEstimate: number + /** 当前请求的IP */ + peerIP: string + /** 当前请求的端口 */ + port: number + /** 收到字节数 */ + receivedBytedCount: number + /** 最后一个 HTTP 重定向完成时的时间。有跳转且是同域名内部的重定向才算,否则值为 0 */ + redirectEnd: number + /** 第一个 HTTP 重定向发生时的时间。有跳转且是同域名内的重定向才算,否则值为 0 */ + redirectStart: number + /** HTTP请求读取真实文档结束的时间 */ + requestEnd: number + /** HTTP请求读取真实文档开始的时间(完成建立连接),包括从本地读取缓存。连接错误重连时,这里显示的也是新建立连接的时间 */ + requestStart: number + /** HTTP 响应全部接收完成的时间(获取到最后一个字节),包括从本地读取缓存 */ + responseEnd: number + /** HTTP 开始接收响应的时间(获取到第一个字节),包括从本地读取缓存 */ + responseStart: number + /** 当次请求连接过程中实时 rtt */ + rtt: number + /** 发送的字节数 */ + sendBytesCount: number + /** 是否复用连接 */ + socketReused: boolean + /** 当前网络的实际下载kbps */ + throughputKbps: number + /** 传输层根据多个请求评估的当前网络的 rtt(仅供参考) */ + transportRttEstimate: number + } interface RequestSubscribeMessageFailCallbackResult { /** 接口调用失败错误码 */ errCode: number @@ -3895,10 +4071,10 @@ innerAudioContext.onError((res) => { * * 最低基础库: `1.2.0` */ header: IAnyObject - /** 网络请求过程中一些关键时间点的耗时信息 + /** 网络请求过程中一些调试信息 * * 最低基础库: `2.10.4` */ - profile: IAnyObject + profile: RequestProfile /** 开发者服务器返回的 HTTP 状态码 */ statusCode: number errMsg: string @@ -3911,6 +4087,14 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: ResumeBGMSuccessCallback } + interface ResumeOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResumeCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ResumeFailCallback + /** 接口调用成功的回调函数 */ + success?: ResumeSuccessCallback + } interface RewardedVideoAdOnCloseCallbackResult { /** 视频是否是在用户完整观看的情况下被关闭的 * @@ -3986,6 +4170,16 @@ innerAudioContext.onError((res) => { * - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足; */ errMsg: string } + interface SaveFileToDiskOption { + /** 待保存文件路径 */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SaveFileToDiskCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SaveFileToDiskFailCallback + /** 接口调用成功的回调函数 */ + success?: SaveFileToDiskSuccessCallback + } interface SaveImageToPhotosAlbumOption { /** 图片文件路径,可以是临时文件路径或永久文件路径 (本地路径) ,不支持网络路径 */ filePath: string @@ -4131,6 +4325,19 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: SetBGMVolumeSuccessCallback } + interface SetBLEMTUOption { + /** 用于区分设备的 id */ + deviceId: string + /** 最大传输单元(22,512) 区间内,单位 bytes + * ``` */ + mtu: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetBLEMTUCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetBLEMTUFailCallback + /** 接口调用成功的回调函数 */ + success?: SetBLEMTUSuccessCallback + } interface SetBackgroundColorOption { /** 窗口的背景色,必须为十六进制颜色值 */ backgroundColor?: string @@ -4366,7 +4573,7 @@ innerAudioContext.onError((res) => { success?: SetWindowSizeSuccessCallback } interface SetZoomOption { - /** 缩放级别,范围[1, maxZoom]。zoom 可取小时,精确到小数后一位。maxZoom 可在 bindinitdone 返回值中获取。 */ + /** 缩放级别,范围[1, maxZoom]。zoom 可取小数,精确到小数后一位。maxZoom 可在 bindinitdone 返回值中获取。 */ zoom: number /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: SetZoomCompleteCallback @@ -4519,6 +4726,27 @@ innerAudioContext.onError((res) => { /** 变化后的窗口宽度,单位 px */ windowWidth: number } + /** 网络请求过程中一些调试信息 + * + * 最低基础库: `2.10.4` */ + interface SocketProfile { + /** 完成建立连接的时间(完成握手),如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接完成的时间。注意这里握手结束,包括安全连接建立完成、SOCKS 授权通过 */ + connectEnd: number + /** 开始建立连接的时间,如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接开始的时间 */ + connectStart: number + /** 上层请求到返回的耗时 */ + cost: number + /** DNS 域名查询完成的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */ + domainLookupEnd: number + /** DNS 域名查询开始的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */ + domainLookupStart: number + /** 组件准备好使用 SOCKET 建立请求的时间,这发生在检查本地缓存之前 */ + fetchStart: number + /** 握手耗时 */ + handshakeCost: number + /** 单次连接的耗时,包括 connect ,tls */ + rtt: number + } interface SocketTaskCloseOption { /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ code?: number @@ -4921,6 +5149,14 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: StopLocationUpdateSuccessCallback } + interface StopOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopFailCallback + /** 接口调用成功的回调函数 */ + success?: StopSuccessCallback + } interface StopPreviewOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: StopPreviewCompleteCallback @@ -5139,9 +5375,9 @@ innerAudioContext.onError((res) => { * * 最低基础库: `2.4.0` */ templateInfo?: UpdatableMessageFrontEndTemplateInfo - /** 群待办消息的id,通过toDoActivityId可以把多个群代办消息聚合为同一个。通过 [updatableMessage.createActivityId](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/updatable-message/updatableMessage.createActivityId.html) 接口获取。(目前仅iOS支持) + /** 群待办消息的id,通过toDoActivityId可以把多个群待办消息聚合为同一个。通过 [updatableMessage.createActivityId](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/updatable-message/updatableMessage.createActivityId.html) 接口获取。详见[群待办消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) * - * 最低基础库: `2.10.4` */ + * 最低基础库: `2.11.0` */ toDoActivityId?: string /** 是否使用带 shareTicket 的转发[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */ withShareTicket?: boolean @@ -5237,6 +5473,12 @@ innerAudioContext.onError((res) => { * 最低基础库: `1.7.0` */ direction?: 0 | 90 | -90 } + interface VideoDecoderStartOption { + /** 需要解码的视频源文件,只支持本地路径 */ + source: string + /** 解码模式。0:按 pts 解码;1:以最快速度解码 */ + mode?: number + } /** 提供预设的 Wi-Fi 信息列表 */ interface WifiData { /** Wi-Fi 的 BSSID */ @@ -5958,7 +6200,7 @@ listener.start() /** [CameraFrameListener.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.stop.html) * * 停止监听帧数据 */ - stop(option?: CameraFrameListenerStopOption): void + stop(option?: StopOption): void } interface Canvas { /** [Canvas.cancelAnimationFrame(number requestID)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.cancelAnimationFrame.html) @@ -5979,6 +6221,17 @@ listener.start() * * 最低基础库: `2.7.0` */ createImage(): Image + /** [[Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) Canvas.createPath2D([Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) path)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createPath2D.html) + * + * 创建 Path2D 对象 + * + * 最低基础库: `2.11.0` */ + createPath2D( + /** [Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) + * + * */ + path: Path2D + ): Path2D /** [[RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) Canvas.getContext(string contextType)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.getContext.html) * * 该方法返回 Canvas 的绘图上下文 @@ -5998,6 +6251,17 @@ listener.start() /** 执行的 callback */ callback: (...args: any[]) => any ): number + /** [string Canvas.toDataURL(string type, number encoderOptions)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.toDataURL.html) + * + * 返回一个包含图片展示的 data URI 。可以使用 type 参数其类型,默认为 PNG 格式。 + * + * 最低基础库: `2.11.0` */ + toDataURL( + /** 图片格式,默认为 image/png */ + type: string, + /** 在指定图片格式为 image/jpeg 或 image/webp的情况下,可以从 0 到 1 的区间内选择图片的质量。如果超出取值范围,将会使用默认值 0.92。其他参数会被忽略。 */ + encoderOptions: number + ): string } interface CanvasContext { /** [CanvasContext.arc(number x, number y, number r, number sAngle, number eAngle, boolean counterclockwise)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.arc.html) @@ -7547,7 +7811,7 @@ ctx.draw() * 最低基础库: `2.1.0` */ offHeadersReceived( /** HTTP Response Header 事件的回调函数 */ - callback: DownloadTaskOffHeadersReceivedCallback + callback: OffHeadersReceivedCallback ): void /** [DownloadTask.offProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offProgressUpdate.html) * @@ -7565,7 +7829,7 @@ ctx.draw() * 最低基础库: `2.1.0` */ onHeadersReceived( /** HTTP Response Header 事件的回调函数 */ - callback: DownloadTaskOnHeadersReceivedCallback + callback: OnHeadersReceivedCallback ): void /** [DownloadTask.onProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onProgressUpdate.html) * @@ -7709,6 +7973,26 @@ this.editorCtx.insertImage({ * 最低基础库: `2.7.0` */ undo(option?: UndoOption): void } + interface EntryList { + /** [Array EntryList.getEntries()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/EntryList.getEntries.html) + * + * 该方法返回当前列表中的所有性能数据 + * + * 最低基础库: `2.11.0` */ + getEntries(): any[] + /** [Array EntryList.getEntriesByName(string name, string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/EntryList.getEntriesByName.html) + * + * 获取当前列表中所有名称为 [name] 且类型为 [entryType] 的性能数据 + * + * 最低基础库: `2.11.0` */ + getEntriesByName(name: string, entryType?: string): any[] + /** [Array EntryList.getEntriesByType(string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/EntryList.getEntriesByType.html) + * + * 获取当前列表中所有类型为 [entryType] 的性能数据 + * + * 最低基础库: `2.11.0` */ + getEntriesByType(entryType: string): any[] + } interface EventChannel { /** [EventChannel.emit(string eventName, any args)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.emit.html) * @@ -8377,10 +8661,10 @@ Page({ * * 退出全屏 */ exitFullScreen(option?: ExitFullScreenOption): void - /** [LivePlayerContext.exitPictureInPicture()](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitPictureInPicture.html) + /** [LivePlayerContext.exitPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitPictureInPicture.html) * - * 退出小窗,该方法可在任意页面调用。 */ - exitPictureInPicture(): void + * 退出小窗,该方法可在任意页面调用 */ + exitPictureInPicture(option?: ExitPictureInPictureOption): void /** [LivePlayerContext.mute(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.mute.html) * * 静音 */ @@ -8390,7 +8674,7 @@ Page({ * 暂停 * * 最低基础库: `1.9.90` */ - pause(option?: LivePlayerContextPauseOption): void + pause(option?: PauseOption): void /** [LivePlayerContext.play(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.play.html) * * 播放 */ @@ -8406,7 +8690,7 @@ Page({ * 恢复 * * 最低基础库: `1.9.90` */ - resume(option?: LivePlayerContextResumeOption): void + resume(option?: ResumeOption): void /** [LivePlayerContext.snapshot(string quality)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.snapshot.html) * * 截图 @@ -8421,13 +8705,13 @@ Page({ /** [LivePlayerContext.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.stop.html) * * 停止 */ - stop(option?: LivePlayerContextStopOption): void + stop(option?: StopOption): void } interface LivePusherContext { /** [LivePusherContext.pause(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.pause.html) * * 暂停推流 */ - pause(option?: LivePusherContextPauseOption): void + pause(option?: PauseOption): void /** [LivePusherContext.pauseBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.pauseBGM.html) * * 暂停背景音 @@ -8443,7 +8727,7 @@ Page({ /** [LivePusherContext.resume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.resume.html) * * 恢复推流 */ - resume(option?: LivePusherContextResumeOption): void + resume(option?: ResumeOption): void /** [LivePusherContext.resumeBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.resumeBGM.html) * * 恢复背景音 @@ -8476,7 +8760,7 @@ Page({ /** [LivePusherContext.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.start.html) * * 开始推流,同时开启摄像头预览 */ - start(option?: LivePusherContextStartOption): void + start(option?: CameraFrameListenerStartOption): void /** [LivePusherContext.startPreview(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.startPreview.html) * * 开启摄像头预览 @@ -8486,7 +8770,7 @@ Page({ /** [LivePusherContext.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.stop.html) * * 停止推流,同时停止摄像头预览 */ - stop(option?: LivePusherContextStopOption): void + stop(option?: StopOption): void /** [LivePusherContext.stopBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.stopBGM.html) * * 停止背景音 @@ -8636,6 +8920,70 @@ Page({ track: MediaTrack ): void } + interface MediaRecorder { + /** [MediaRecorder.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.destroy.html) + * + * 销毁录制器 + * + * 最低基础库: `2.11.0` */ + destroy(): void + /** [MediaRecorder.off(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.off.html) + * + * 取消监听录制事件。当对应事件触发时,该回调函数不再执行。 + * + * 最低基础库: `2.11.0` */ + off( + /** 事件名 */ + eventName: string, + /** 事件触发时执行的回调函数 */ + callback: (...args: any[]) => any + ): void + /** [MediaRecorder.on(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.on.html) + * + * 注册监听录制事件的回调函数。当对应事件触发时,回调函数会被执行。 + * + * 最低基础库: `2.11.0` */ + on( + /** 事件名 + * + * 参数 eventName 可选值: + * - 'start': 录制开始事件。; + * - 'stop': 录制结束事件。返回 {tempFilePath, duration, fileSize}; */ + eventName: 'start' | 'stop', + /** 事件触发时执行的回调函数 */ + callback: (...args: any[]) => any + ): void + /** [MediaRecorder.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.pause.html) + * + * 暂停录制 + * + * 最低基础库: `2.11.0` */ + pause(): void + /** [MediaRecorder.requestFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.requestFrame.html) + * + * 请求下一帧录制,在 callback 里完成一帧渲染后开始录制当前帧 + * + * 最低基础库: `2.11.0` */ + requestFrame(callback: (...args: any[]) => any): void + /** [MediaRecorder.resume()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.resume.html) + * + * 恢复录制 + * + * 最低基础库: `2.11.0` */ + resume(): void + /** [MediaRecorder.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.start.html) + * + * 开始录制 + * + * 最低基础库: `2.11.0` */ + start(): void + /** [MediaRecorder.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.stop.html) + * + * 结束录制 + * + * 最低基础库: `2.11.0` */ + stop(): void + } interface NFCError { /** 错误信息 * @@ -8827,6 +9175,55 @@ Page({ * 最低基础库: `2.7.0` */ getContext(contextType: string): any } + interface Performance { + /** [Array Performance.getEntries()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.getEntries.html) + * + * 该方法返回当前缓冲区中的所有性能数据 + * + * 最低基础库: `2.11.0` */ + getEntries(): any[] + /** [Array Performance.getEntriesByName(string name, string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.getEntriesByName.html) + * + * 获取当前缓冲区中所有名称为 [name] 且类型为 [entryType] 的性能数据 + * + * 最低基础库: `2.11.0` */ + getEntriesByName(name: string, entryType?: string): any[] + /** [Array Performance.getEntriesByType(string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.getEntriesByType.html) + * + * 获取当前缓冲区中所有类型为 [entryType] 的性能数据 + * + * 最低基础库: `2.11.0` */ + getEntriesByType(entryType: string): any[] + /** [Performance.setBufferSize(number size)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.setBufferSize.html) + * + * 设置缓冲区大小, 默认缓冲 30 条性能数据 + * + * 最低基础库: `2.11.0` */ + setBufferSize(size: number): void + /** [[PerformanceObserver](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/PerformanceObserver.html) Performance.createObserver(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.createObserver.html) + * + * 创建全局性能事件监听器 + * + * 最低基础库: `2.11.0` */ + createObserver(callback: (...args: any[]) => any): PerformanceObserver + } + interface PerformanceObserver { + /** [PerformanceObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/PerformanceObserver.disconnect.html) + * + * 停止监听 + * + * 最低基础库: `2.11.0` */ + disconnect(): void + /** [PerformanceObserver.observe(Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/PerformanceObserver.observe.html) + * + * 开始监听 + * + * 最低基础库: `2.11.0` */ + observe( + /** 设置 type 监听单个类型的指标,设置 entryTypes 监听多个类型指标。 */ + options: IAnyObject + ): void + } interface RealtimeLogManager { /** [RealtimeLogManager.addFilterMsg(string msg)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.addFilterMsg.html) * @@ -8992,7 +9389,7 @@ Page({ * 最低基础库: `2.1.0` */ offHeadersReceived( /** HTTP Response Header 事件的回调函数 */ - callback: RequestTaskOffHeadersReceivedCallback + callback: OffHeadersReceivedCallback ): void /** [RequestTask.onHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.onHeadersReceived.html) * @@ -9001,7 +9398,7 @@ Page({ * 最低基础库: `2.1.0` */ onHeadersReceived( /** HTTP Response Header 事件的回调函数 */ - callback: RequestTaskOnHeadersReceivedCallback + callback: OnHeadersReceivedCallback ): void } interface RewardedVideoAd { @@ -9318,7 +9715,7 @@ Component({ * 最低基础库: `2.1.0` */ offHeadersReceived( /** HTTP Response Header 事件的回调函数 */ - callback: UploadTaskOffHeadersReceivedCallback + callback: OffHeadersReceivedCallback ): void /** [UploadTask.offProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.offProgressUpdate.html) * @@ -9336,7 +9733,7 @@ Component({ * 最低基础库: `2.1.0` */ onHeadersReceived( /** HTTP Response Header 事件的回调函数 */ - callback: UploadTaskOnHeadersReceivedCallback + callback: OnHeadersReceivedCallback ): void /** [UploadTask.onProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onProgressUpdate.html) * @@ -9355,6 +9752,10 @@ Component({ * * 最低基础库: `1.4.0` */ exitFullScreen(): void + /** [VideoContext.exitPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitPictureInPicture.html) + * + * 退出小窗,该方法可在任意页面调用 */ + exitPictureInPicture(option?: ExitPictureInPictureOption): void /** [VideoContext.hideStatusBar()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.hideStatusBar.html) * * 隐藏状态栏,仅在iOS全屏下有效 @@ -9411,6 +9812,68 @@ Component({ * 最低基础库: `1.7.0` */ stop(): void } + interface VideoDecoder { + /** [Object VideoDecoder.getFrameData()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.getFrameData.html) + * + * 获取下一帧的解码数据 + * + * 最低基础库: `2.11.0` */ + getFrameData(): IAnyObject + /** [VideoDecoder.off(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.off.html) + * + * 取消监听录制事件。当对应事件触发时,该回调函数不再执行 + * + * 最低基础库: `2.11.0` */ + off( + /** 事件名 */ + eventName: string, + /** 事件触发时执行的回调函数 */ + callback: (...args: any[]) => any + ): void + /** [VideoDecoder.on(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.on.html) + * + * 注册监听录制事件的回调函数。当对应事件触发时,回调函数会被执行 + * + * 最低基础库: `2.11.0` */ + on( + /** 事件名 + * + * 参数 eventName 可选值: + * - 'start': 开始事件。返回 {width, height}; + * - 'stop': 结束事件。; + * - 'seek': seek 完成事件。; */ + eventName: 'start' | 'stop' | 'seek', + /** 事件触发时执行的回调函数 */ + callback: (...args: any[]) => any + ): void + /** [VideoDecoder.remove()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.remove.html) + * + * 移除解码器 + * + * 最低基础库: `2.11.0` */ + remove(): void + /** [VideoDecoder.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.seek.html) + * + * 跳到某个时间点解码 + * + * 最低基础库: `2.11.0` */ + seek( + /** 跳转的解码位置,单位 ms */ + position: number + ): void + /** [VideoDecoder.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.start.html) + * + * 开始解码 + * + * 最低基础库: `2.11.0` */ + start(option: VideoDecoderStartOption): void + /** [VideoDecoder.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.stop.html) + * + * 停止解码 + * + * 最低基础库: `2.11.0` */ + stop(): void + } interface WifiError { /** 错误信息 * @@ -9796,6 +10259,16 @@ logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3]) * * 最低基础库: `2.9.0` */ createMediaContainer(): MediaContainer + /** [[MediaRecorder](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.html) wx.createMediaRecorder(Object canvas, Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/wx.createMediaRecorder.html) + * + * 创建 WebGL 画面录制器,可逐帧录制在 WebGL 上渲染的画面并导出视频文件 + * + * 最低基础库: `2.11.0` */ + createMediaRecorder( + /** WebGL 对象,通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取到的 node 对象 */ + canvas: IAnyObject, + options: CreateMediaRecorderOption + ): MediaRecorder /** [[OffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.html) wx.createOffscreenCanvas()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html) * * 创建离屏 canvas 实例 @@ -9953,6 +10426,12 @@ wx.chooseImage({ /** 在自定义组件下,当前组件实例的this,以操作组件内 [video](https://developers.weixin.qq.com/miniprogram/dev/component/video.html) 组件 */ component?: Component.TrivialInstance | Page.TrivialInstance ): VideoContext + /** [[VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) wx.createVideoDecoder()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/wx.createVideoDecoder.html) + * + * 创建视频解码器,可逐帧获取解码后的数据 + * + * 最低基础库: `2.11.0` */ + createVideoDecoder(): VideoDecoder /** [[Worker](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.html) wx.createWorker(string scriptPath)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/wx.createWorker.html) * * 创建一个 [Worker 线程](https://developers.weixin.qq.com/miniprogram/dev/framework/workers.html)。目前限制最多只能创建一个 Worker,创建下一个 Worker 前请先调用 [Worker.terminate](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.terminate.html) @@ -10337,8 +10816,8 @@ wx.chooseMedia({ maxDuration: 30, camera: 'back', success(res) { - console.log(res.tempFilePath) - console.log(res.size) + console.log(res.tempFiles.tempFilePath) + console.log(res.tempFiles.size) } }) ``` @@ -10513,6 +10992,14 @@ wx.compressImage({ compressImage( option: TOption ): PromisifySuccessResult + /** [wx.compressVideo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.compressVideo.html) + * + * 压缩视频接口。开发者可指定压缩质量 `quality` 进行压缩。当需要更精细的控制时,可指定 `bitrate`、`fps`、和 `resolution`,当 `quality` 传入时,这三个参数将被忽略。原视频的相关信息可通过 [getVideoInfo](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.getVideoInfo.html) 获取。 + * + * 最低基础库: `2.11.0` */ + compressVideo( + option: TOption + ): PromisifySuccessResult /** [wx.connectWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.connectWifi.html) * * 连接 Wi-Fi。若已知 Wi-Fi 信息,可以直接利用该接口连接。仅 Android 与 iOS 11 以上版本支持。 @@ -10611,6 +11098,14 @@ wx.getBLEDeviceCharacteristics({ >( option: TOption ): PromisifySuccessResult + /** [wx.getBLEDeviceRSSI(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceRSSI.html) + * + * 获取蓝牙设备的信号强度。 + * + * 最低基础库: `2.11.0` */ + getBLEDeviceRSSI( + option: TOption + ): PromisifySuccessResult /** [wx.getBLEDeviceServices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceServices.html) * * 获取蓝牙设备所有服务(service)。 @@ -10896,7 +11391,7 @@ wx.chooseImage({ ): PromisifySuccessResult /** [wx.getLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html) * -* 获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用。开启高精度定位,接口耗时会增加,可指定 highAccuracyExpireTime 作为超时时间。 +* 获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用。开启高精度定位,接口耗时会增加,可指定 highAccuracyExpireTime 作为超时时间。地图相关使用的坐标格式应为 gcj02。 * * **示例代码** * @@ -10938,6 +11433,38 @@ wx.getNetworkType({ getNetworkType( option?: TOption ): PromisifySuccessResult + /** [wx.getPerformance()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/wx.getPerformance.html) +* +* 获取当前小程序性能相关的信息。 +* +* **** +* +* 目前支持获取以下几类性能指标: +* +* | 类别 | 名称 (entryType) | 指标 | +* | ---- | ---------------- | ---------------- | +* | 路由 | navigation | route, appLaunch | +* | 渲染 | render | firstRender | +* | 脚本 | script | evaluateScript | +* +* - route: 路由性能 +* - appLaunch: 小程序启动耗时 +* - firstRender: 页面首次渲染耗时 +* - evaluateScript: 注入脚本耗时 +* +* **示例代码** +* +* +* ```js +const performance = wx.getPerformance() +const observer = performance.createObserver((entryList) => { + console.log(entryList.getEntries()) +}) +observer.observe({ entryTypes: ['render', 'script'] }) +``` +* +* 最低基础库: `2.11.0` */ + getPerformance(): void /** [wx.getSavedFileInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getSavedFileInfo.html) * * 获取本地文件的文件信息。此接口只能用于获取已保存到本地的文件,若需要获取临时文件信息,请使用 [wx.getFileInfo()](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileInfo.html) 接口。 @@ -11257,6 +11784,14 @@ Page({ }) ``` */ getUserInfo(option: GetUserInfoOption): void + /** [wx.getVideoInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.getVideoInfo.html) + * + * 获取视频详细信息。 + * + * 最低基础库: `2.11.0` */ + getVideoInfo( + option: TOption + ): PromisifySuccessResult /** [wx.getWeRunData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.getWeRunData.html) * * 获取用户过去三十天微信运动步数。需要先调用 [wx.login](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html) 接口。步数信息会在用户主动进入小程序时更新。 @@ -11547,12 +12082,18 @@ Page({ * **使用限制** * * -* ##### 需要用户触发跳转 -* 从 2.3.0 版本开始,若用户未点击小程序页面任意位置,则开发者将无法调用此接口自动跳转至其他小程序。 -* ##### 需要用户确认跳转 -* 从 2.3.0 版本开始,在跳转至其他小程序前,将统一增加弹窗,询问是否跳转,用户确认后才可以跳转其他小程序。如果用户点击取消,则回调 `fail cancel`。 -* ##### 每个小程序可跳转的其他小程序数量限制为不超过 10 个 -* 从 2.4.0 版本以及指定日期(具体待定)开始,开发者提交新版小程序代码时,如使用了跳转其他小程序功能,则需要在代码配置中声明将要跳转的小程序名单,限定不超过 10 个,否则将无法通过审核。该名单可在发布新版时更新,不支持动态修改。配置方法详见 [小程序全局配置](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html)。调用此接口时,所跳转的 appId 必须在配置列表中,否则回调 `fail appId "${appId}" is not in navigateToMiniProgramAppIdList`。 +* ##### 需要用户触发跳转 +* 从 2.3.0 版本开始,若用户未点击小程序页面任意位置,则开发者将无法调用此接口自动跳转至其他小程序。 +* ##### 需要用户确认跳转 +* 从 2.3.0 版本开始,在跳转至其他小程序前,将统一增加弹窗,询问是否跳转,用户确认后才可以跳转其他小程序。如果用户点击取消,则回调 `fail cancel`。 +* ##### 无需声明跳转名单,不限跳转数量(众测中) +* 1. 从2020年4月24日起,使用跳转其他小程序功能将无需在全局配置中声明跳转名单,调用此接口时将不再校验所跳转的 AppID 是否在 navigateToMiniProgramAppIdList 中。 +* 2. 从2020年4月24日起,跳转其他小程序将不再受数量限制,使用此功能时请注意遵守运营规范。 +* +* **运营规范** +* +* +* 平台将坚决打击小程序盒子等互推行为,使用此功能时请严格遵守[《微信小程序平台运营规范》](https://developers.weixin.qq.com/miniprogram/product/#_5-10-%E4%BA%92%E6%8E%A8%E8%A1%8C%E4%B8%BA),若发现小程序违反运营规范将被下架处理。 * * **关于调试** * @@ -11895,6 +12436,15 @@ wx.notifyBLECharacteristicValueChange({ /** 小程序要打开的页面不存在事件的回调函数 */ callback: OffPageNotFoundCallback ): void + /** [wx.offThemeChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offThemeChange.html) + * + * 取消监听系统主题改变事件 + * + * 最低基础库: `2.11.0` */ + offThemeChange( + /** 系统主题改变事件的回调函数 */ + callback: OffThemeChangeCallback + ): void /** [wx.offUnhandledRejection(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offUnhandledRejection.html) * * 取消监听未处理的 Promise 拒绝事件 @@ -12390,6 +12940,20 @@ wx.onNetworkStatusChange(function (res) { /** WebSocket 连接打开事件的回调函数 */ callback: OnSocketOpenCallback ): void + /** [wx.onThemeChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onThemeChange.html) + * + * 监听系统主题改变事件。该事件与 [`App.onThemeChange`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onThemeChange-Object-object) 的回调时机一致。 + * + * **注意** + * + * + * - 只有在全局配置"darkmode": true时才会触发此事件。 + * + * 最低基础库: `2.11.0` */ + onThemeChange( + /** 系统主题改变事件的回调函数 */ + callback: OnThemeChangeCallback + ): void /** [wx.onUnhandledRejection(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html) * * 监听未处理的 Promise 拒绝事件。该事件与 `App.onUnhandledRejection` 的回调时机与参数一致。 @@ -12881,7 +13445,7 @@ wx.reportMonitor('1', 1) /** 上报数值,经处理后会在「小程序管理后台」上展示每分钟的上报总量 */ value: number ): void - /** [wx.reportPerformance(Number id, Number value)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/wx.reportPerformance.html) + /** [wx.reportPerformance(Number id, Number value, String|Array dimensions)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/wx.reportPerformance.html) * * 小程序测速上报。使用前,需要在小程序管理后台配置。 详情参见[小程序测速](#)指南。 * @@ -12890,6 +13454,7 @@ wx.reportMonitor('1', 1) * * ```js wx.reportPerformance(1101, 680) +wx.reportPerformance(1101, 680, 'custom') ``` * * 最低基础库: `2.9.2` */ @@ -12897,7 +13462,9 @@ wx.reportPerformance(1101, 680) /** 指标 id */ id: number, /** 需要上报的数值 */ - value: number + value: number, + /** 自定义维度 (选填) */ + dimensions?: string | any[] ): void /** [wx.requestPayment(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/payment/wx.requestPayment.html) * @@ -12937,7 +13504,7 @@ wx.requestPayment({ * | errCode | errMsg | 说明 | * | ------- | ------------------------------------------------------ | -------------------------------------------------------------- | * | 10001 | TmplIds can't be empty | 参数传空了 | -* | 10002 | Request list fai | 网络问题,请求消息列表失败 | +* | 10002 | Request list fail | 网络问题,请求消息列表失败 | * | 10003 | Request subscribe fail | 网络问题,订阅请求发送失败 | * | 10004 | Invalid template id | 参数类型错误 | * | 10005 | Cannot show subscribe message UI | 无法展示 UI,一般是小程序这个时候退后台了导致的 | @@ -12989,6 +13556,12 @@ wx.chooseImage({ saveFile( option: TOption ): PromisifySuccessResult + /** [wx.saveFileToDisk(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.saveFileToDisk.html) + * + * 保存文件系统的文件到用户磁盘,仅在 PC 端支持 + * + * 最低基础库: `2.11.0` */ + saveFileToDisk(option: SaveFileToDiskOption): void /** [wx.saveImageToPhotosAlbum(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html) * * 保存图片到系统相册。 @@ -13129,6 +13702,14 @@ function sendSocketMessage(msg) { sendSocketMessage( option: TOption ): PromisifySuccessResult + /** [wx.setBLEMTU(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.setBLEMTU.html) + * + * 设置蓝牙最大传输单元。需在 wx.createBLEConnection调用成功后调用,mtu 设置范围 (22,512)。安卓5.1以上有效。 + * + * 最低基础库: `2.11.0` */ + setBLEMTU( + option: TOption + ): PromisifySuccessResult /** [wx.setBackgroundColor(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/background/wx.setBackgroundColor.html) * * 动态设置窗口的背景色 @@ -14467,6 +15048,14 @@ wx.writeBLECharacteristicValue({ result: CompressImageSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type CompressVideoCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type CompressVideoFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type CompressVideoSuccessCallback = ( + result: CompressVideoSuccessCallbackResult + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ConnectSocketCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type ConnectSocketFailCallback = (res: GeneralCallbackResult) => void @@ -14512,18 +15101,10 @@ wx.writeBLECharacteristicValue({ type DownloadFileSuccessCallback = ( result: DownloadFileSuccessCallbackResult ) => void - /** HTTP Response Header 事件的回调函数 */ - type DownloadTaskOffHeadersReceivedCallback = ( - result: OnHeadersReceivedCallbackResult - ) => void /** 下载进度变化事件的回调函数 */ type DownloadTaskOffProgressUpdateCallback = ( result: DownloadTaskOnProgressUpdateCallbackResult ) => void - /** HTTP Response Header 事件的回调函数 */ - type DownloadTaskOnHeadersReceivedCallback = ( - result: OnHeadersReceivedCallbackResult - ) => void /** 下载进度变化事件的回调函数 */ type DownloadTaskOnProgressUpdateCallback = ( result: DownloadTaskOnProgressUpdateCallbackResult @@ -14539,6 +15120,16 @@ wx.writeBLECharacteristicValue({ type ExitFullScreenFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type ExitFullScreenSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type ExitPictureInPictureCompleteCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用失败的回调函数 */ + type ExitPictureInPictureFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type ExitPictureInPictureSuccessCallback = ( + res: GeneralCallbackResult + ) => void /** 回调函数 */ type FieldsCallback = ( /** 节点的相关信息 */ @@ -14591,6 +15182,14 @@ wx.writeBLECharacteristicValue({ result: GetBLEDeviceCharacteristicsSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type GetBLEDeviceRSSICompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type GetBLEDeviceRSSIFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type GetBLEDeviceRSSISuccessCallback = ( + result: GetBLEDeviceRSSISuccessCallbackResult + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetBLEDeviceServicesCompleteCallback = (res: BluetoothError) => void /** 接口调用失败的回调函数 */ type GetBLEDeviceServicesFailCallback = (res: BluetoothError) => void @@ -14873,6 +15472,14 @@ wx.writeBLECharacteristicValue({ result: GetUserInfoSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type GetVideoInfoCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type GetVideoInfoFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type GetVideoInfoSuccessCallback = ( + result: GetVideoInfoSuccessCallbackResult + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetWeRunDataCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type GetWeRunDataFailCallback = (res: GeneralCallbackResult) => void @@ -15111,7 +15718,7 @@ wx.writeBLECharacteristicValue({ /** 小程序切后台事件的回调函数 */ type OffAppHideCallback = (res: GeneralCallbackResult) => void /** 小程序切前台事件的回调函数 */ - type OffAppShowCallback = (result: OffAppShowCallbackResult) => void + type OffAppShowCallback = (result: OnAppShowCallbackResult) => void /** 音频因为受到系统占用而被中断开始事件的回调函数 */ type OffAudioInterruptionBeginCallback = ( res: GeneralCallbackResult @@ -15138,6 +15745,10 @@ wx.writeBLECharacteristicValue({ ) => void /** 音频自然播放至结束的事件的回调函数 */ type OffEndedCallback = (res: GeneralCallbackResult) => void + /** HTTP Response Header 事件的回调函数 */ + type OffHeadersReceivedCallback = ( + result: OnHeadersReceivedCallbackResult + ) => void /** 开始监听数据包消息的事件的回调函数 */ type OffListeningCallback = (res: GeneralCallbackResult) => void /** mDNS 服务停止搜索的事件的回调函数 */ @@ -15161,7 +15772,7 @@ wx.writeBLECharacteristicValue({ result: OnLocationChangeCallbackResult ) => void /** 收到消息的事件的回调函数 */ - type OffMessageCallback = (result: OffMessageCallbackResult) => void + type OffMessageCallback = (result: UDPSocketOnMessageCallbackResult) => void /** 小程序要打开的页面不存在事件的回调函数 */ type OffPageNotFoundCallback = ( result: OnPageNotFoundCallbackResult @@ -15176,6 +15787,8 @@ wx.writeBLECharacteristicValue({ type OffSeekingCallback = (res: GeneralCallbackResult) => void /** 音频停止事件的回调函数 */ type OffStopCallback = (res: GeneralCallbackResult) => void + /** 系统主题改变事件的回调函数 */ + type OffThemeChangeCallback = (result: OnThemeChangeCallbackResult) => void /** 音频播放进度更新事件的回调函数 */ type OffTimeUpdateCallback = (res: GeneralCallbackResult) => void /** 未处理的 Promise 拒绝事件的回调函数 */ @@ -15186,7 +15799,7 @@ wx.writeBLECharacteristicValue({ type OffWaitingCallback = (res: GeneralCallbackResult) => void /** 窗口尺寸变化事件的回调函数 */ type OffWindowResizeCallback = ( - result: OffWindowResizeCallbackResult + result: OnWindowResizeCallbackResult ) => void /** 加速度数据事件的回调函数 */ type OnAccelerometerChangeCallback = ( @@ -15283,6 +15896,10 @@ wx.writeBLECharacteristicValue({ ) => void /** 接收 NFC 设备消息事件的回调函数 */ type OnHCEMessageCallback = (result: OnHCEMessageCallbackResult) => void + /** HTTP Response Header 事件的回调函数 */ + type OnHeadersReceivedCallback = ( + result: OnHeadersReceivedCallbackResult + ) => void /** 录音因为受到系统占用而被中断开始事件的回调函数 */ type OnInterruptionBeginCallback = (res: GeneralCallbackResult) => void /** 录音中断结束事件的回调函数 */ @@ -15346,6 +15963,8 @@ wx.writeBLECharacteristicValue({ type OnSocketOpenCallback = (result: OnSocketOpenCallbackResult) => void /** 录音开始事件的回调函数 */ type OnStartCallback = (res: GeneralCallbackResult) => void + /** 系统主题改变事件的回调函数 */ + type OnThemeChangeCallback = (result: OnThemeChangeCallbackResult) => void /** 未处理的 Promise 拒绝事件的回调函数 */ type OnUnhandledRejectionCallback = ( result: OnUnhandledRejectionCallbackResult @@ -15582,14 +16201,6 @@ wx.writeBLECharacteristicValue({ ) => void /** 接口调用成功的回调函数 */ type RequestSuccessCallback = (result: RequestSuccessCallbackResult) => void - /** HTTP Response Header 事件的回调函数 */ - type RequestTaskOffHeadersReceivedCallback = ( - result: OnHeadersReceivedCallbackResult - ) => void - /** HTTP Response Header 事件的回调函数 */ - type RequestTaskOnHeadersReceivedCallback = ( - result: OnHeadersReceivedCallbackResult - ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ResumeBGMCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ @@ -15631,6 +16242,12 @@ wx.writeBLECharacteristicValue({ /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SaveFileCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type SaveFileToDiskCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type SaveFileToDiskFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type SaveFileToDiskSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SaveImageToPhotosAlbumCompleteCallback = ( res: GeneralCallbackResult ) => void @@ -15701,6 +16318,12 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type SetBGMVolumeSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type SetBLEMTUCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type SetBLEMTUFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type SetBLEMTUSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SetBackgroundColorCompleteCallback = ( res: GeneralCallbackResult ) => void @@ -16302,18 +16925,10 @@ wx.writeBLECharacteristicValue({ type UploadFileSuccessCallback = ( result: UploadFileSuccessCallbackResult ) => void - /** HTTP Response Header 事件的回调函数 */ - type UploadTaskOffHeadersReceivedCallback = ( - result: OnHeadersReceivedCallbackResult - ) => void /** 上传进度变化事件的回调函数 */ type UploadTaskOffProgressUpdateCallback = ( result: UploadTaskOnProgressUpdateCallbackResult ) => void - /** HTTP Response Header 事件的回调函数 */ - type UploadTaskOnHeadersReceivedCallback = ( - result: OnHeadersReceivedCallbackResult - ) => void /** 上传进度变化事件的回调函数 */ type UploadTaskOnProgressUpdateCallback = ( result: UploadTaskOnProgressUpdateCallbackResult From 1ae404cfd34885cf57e0988e815d91d82e4b19a0 Mon Sep 17 00:00:00 2001 From: SgLy <775150558@qq.com> Date: Mon, 15 Jun 2020 21:34:33 +0800 Subject: [PATCH 018/205] fix: several bugs, see changelog for detail --- CHANGELOG.md | 7 + VERSIONS.md | 2 +- package-lock.json | 2 +- package.json | 2 +- test/app.test.ts | 3 + test/issue.test.ts | 71 +++++++++ test/page.test.ts | 14 ++ tslint.json | 2 +- types/wx/lib.wx.api.d.ts | 260 +++++++++++---------------------- types/wx/lib.wx.app.d.ts | 6 + types/wx/lib.wx.component.d.ts | 37 ++++- types/wx/lib.wx.page.d.ts | 22 +++ 12 files changed, 242 insertions(+), 186 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bb7137..8431347 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 2020-06-15 v2.11.0-1 +- 该版本继续合并了一部分完全相同的 interface / callback,是一个 **破坏性改动**,原本字面上引用了这些 interface / callback 的代码可能会报错。 +- 为 `Component` 构造器增加第四个泛型,以允许在自定义组件上挂载自定义的字段 ([#133](https://github.com/wechat-miniprogram/api-typings/issues/133)) +- 修复一些接口错误 ([#134](https://github.com/wechat-miniprogram/api-typings/issues/134)) +- 补齐 `App` 的 `onThemeChange` ([#135](https://github.com/wechat-miniprogram/api-typings/issues/135)) +- 补齐 `Page` 的 `onAddToFavorites` ([#136](https://github.com/wechat-miniprogram/api-typings/issues/136)) + ## 2020-05-20 v2.11.0 - 同步 API 定义到基础库 2.11.0 - 该版本继续合并了一部分完全相同的 interface / callback,是一个 **破坏性改动**,原本字面上引用了这些 interface / callback 的代码可能会报错。 diff --git a/VERSIONS.md b/VERSIONS.md index 2163489..cc6d558 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -2,7 +2,7 @@ 基础库版本|npm 版本|命令 -|-|- -[v2.11.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-11-0-2020-04-24) | [2.11.0](https://www.npmjs.com/package/miniprogram-api-typings/v/2.11.0) | `npm install miniprogram-api-typings@2.11.0` +[v2.11.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-11-0-2020-04-24) | [2.11.0-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.11.0-1) | `npm install miniprogram-api-typings@2.11.0-1` [v2.10.4](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-4-2020-03-24) | [2.10.4](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.4) | `npm install miniprogram-api-typings@2.10.4` [v2.10.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-3-2020-03-06) | [2.10.3-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.3-1) | `npm install miniprogram-api-typings@2.10.3-1` [v2.10.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-2-2020-02-20) | [2.10.2-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.2-1) | `npm install miniprogram-api-typings@2.10.2-1` diff --git a/package-lock.json b/package-lock.json index f46a5e5..77124ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.11.0", + "version": "2.11.0-1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 1d72763..5917feb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.11.0", + "version": "2.11.0-1", "description": "Type definitions for APIs of Wechat Mini Program in TypeScript", "main": "./index.d.ts", "types": "./index.d.ts", diff --git a/test/app.test.ts b/test/app.test.ts index 5fb9298..751f166 100644 --- a/test/app.test.ts +++ b/test/app.test.ts @@ -43,6 +43,9 @@ App({ expectType(reason) expectType>(promise) }, + onThemeChange(res) { + expectType<'dark' | 'light'>(res.theme) + }, }) expectType>>(getApp()) diff --git a/test/issue.test.ts b/test/issue.test.ts index cd4aaf9..883631f 100644 --- a/test/issue.test.ts +++ b/test/issue.test.ts @@ -273,3 +273,74 @@ import WX = WechatMiniprogram }, }) } + +// https://github.com/wechat-miniprogram/api-typings/issues/133 +{ + type IData = { + name: string, + } + type IProperty = { + id: typeof Number, + } + type IMethod = { + setJob(job: string): void, + } + type ICustomInstanceProperty = { + job: string, + } + Component({ + properties: { + id: Number, + }, + + data: { + name: '', + }, + + methods: { + setJob(job) { + this.job = job + expectType(this.job) + }, + }, + }) +} + +// https://github.com/wechat-miniprogram/api-typings/issues/134 +{ + const ctx = wx.createMapContext('map') + ctx.getRegion({ + success(res) { + expectType(res.southwest.longitude) + expectType(res.southwest.latitude) + expectType(res.northeast.longitude) + expectType(res.northeast.latitude) + }, + }) +} + +// https://github.com/wechat-miniprogram/api-typings/issues/135 +{ + App({ + onThemeChange(res) { + expectType<'light' | 'dark'>(res.theme) + }, + }) +} + +// https://github.com/wechat-miniprogram/api-typings/issues/136 +{ + Page({ + onAddToFavorites(res) { + if (res.webviewUrl) { + // webview 页面返回 webviewUrl + expectType(res.webviewUrl) + } + return { + title: '自定义标题', + imageUrl: 'http://demo.png', + query: 'name=xxx&age=xxx', + } + }, + }) +} diff --git a/test/page.test.ts b/test/page.test.ts index d3375f3..edda3fd 100644 --- a/test/page.test.ts +++ b/test/page.test.ts @@ -209,3 +209,17 @@ Page({ expectError(channel.emit(1, 2)) }, }) + +Page({ + onAddToFavorites(res) { + // webview 页面返回 webviewUrl + if (res.webviewUrl) { + console.log('WebviewUrl: ', res.webviewUrl) + } + return { + title: '自定义标题', + imageUrl: 'http://demo.png', + query: 'name=xxx&age=xxx', + } + }, +}) diff --git a/tslint.json b/tslint.json index 53f5e7a..f9a3652 100644 --- a/tslint.json +++ b/tslint.json @@ -56,7 +56,7 @@ ] }, "interface-name": false, - "interface-over-type-literal": true, + "interface-over-type-literal": false, "no-angle-bracket-type-assertion": true, "no-arg": true, "no-conditional-assignment": true, diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index e77e7c7..84c9627 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -350,6 +350,22 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 页面链接,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */ webUrl: string } + interface BlueToothDevice { + /** 当前蓝牙设备的信号强度 */ + RSSI: number + /** 当前蓝牙设备的广播数据段中的 ManufacturerData 数据段。 */ + advertisData: ArrayBuffer + /** 当前蓝牙设备的广播数据段中的 ServiceUUIDs 数据段 */ + advertisServiceUUIDs: string[] + /** 用于区分设备的 id */ + deviceId: string + /** 当前蓝牙设备的广播数据段中的 LocalName 数据段 */ + localName: string + /** 蓝牙设备名称,某些设备可能没有 */ + name: string + /** 当前蓝牙设备的广播数据段中的 ServiceData 数据段 */ + serviceData: IAnyObject + } /** 搜索到的设备列表 */ interface BluetoothDeviceInfo { /** 用于区分设备的 id */ @@ -398,23 +414,6 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 宽度 */ width: number } - /** 新搜索到的设备列表 */ - interface CallbackResultBlueToothDevice { - /** 当前蓝牙设备的信号强度 */ - RSSI: number - /** 当前蓝牙设备的广播数据段中的 ManufacturerData 数据段。 */ - advertisData: ArrayBuffer - /** 当前蓝牙设备的广播数据段中的 ServiceUUIDs 数据段 */ - advertisServiceUUIDs: string[] - /** 用于区分设备的 id */ - deviceId: string - /** 当前蓝牙设备的广播数据段中的 LocalName 数据段 */ - localName: string - /** 蓝牙设备名称,某些设备可能没有 */ - name: string - /** 当前蓝牙设备的广播数据段中的 ServiceData 数据段 */ - serviceData: IAnyObject - } interface CameraContextStartRecordOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: StartRecordCompleteCallback @@ -1524,6 +1523,14 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 是否返回节点尺寸(`width` `height`) */ size?: boolean } + interface FileItem { + /** 文件保存时的时间戳,从1970/01/01 08:00:00 到当前时间的秒数 */ + createTime: number + /** 文件路径 (本地路径) */ + filePath: string + /** 本地文件大小,以字节为单位 */ + size: number + } interface FileSystemManagerGetFileInfoOption { /** 要读取的文件路径 (本地路径) */ filePath: string @@ -1549,18 +1556,9 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb } interface FileSystemManagerGetSavedFileListSuccessCallbackResult { /** 文件数组 */ - fileList: FileSystemManagerGetSavedFileListSuccessCallbackResultFileItem[] + fileList: FileItem[] errMsg: string } - /** 文件数组 */ - interface FileSystemManagerGetSavedFileListSuccessCallbackResultFileItem { - /** 文件保存时的时间戳,从1970/01/01 08:00:00 到当前时间的秒数 */ - createTime: number - /** 文件路径 (本地路径) */ - filePath: string - /** 本地文件大小,以字节为单位 */ - size: number - } interface FileSystemManagerRemoveSavedFileOption { /** 需要删除的文件路径 (本地路径) */ filePath: string @@ -1768,26 +1766,9 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb } interface GetBluetoothDevicesSuccessCallbackResult { /** uuid 对应的的已连接设备列表 */ - devices: GetBluetoothDevicesSuccessCallbackResultBlueToothDevice[] + devices: BlueToothDevice[] errMsg: string } - /** uuid 对应的的已连接设备列表 */ - interface GetBluetoothDevicesSuccessCallbackResultBlueToothDevice { - /** 当前蓝牙设备的信号强度 */ - RSSI: number - /** 当前蓝牙设备的广播数据段中的 ManufacturerData 数据段。 */ - advertisData: ArrayBuffer - /** 当前蓝牙设备的广播数据段中的 ServiceUUIDs 数据段 */ - advertisServiceUUIDs: string[] - /** 用于区分设备的 id */ - deviceId: string - /** 当前蓝牙设备的广播数据段中的 LocalName 数据段 */ - localName: string - /** 蓝牙设备名称,某些设备可能没有 */ - name: string - /** 当前蓝牙设备的广播数据段中的 ServiceData 数据段 */ - serviceData: IAnyObject - } interface GetCenterLocationOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: GetCenterLocationCompleteCallback @@ -2018,9 +1999,9 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb } interface GetRegionSuccessCallbackResult { /** 东北角经纬度 */ - northeast: number + northeast: MapPostion /** 西南角经纬度 */ - southwest: number + southwest: MapPostion errMsg: string } interface GetRotateOption { @@ -2300,10 +2281,6 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb statusBarHeight: number /** 操作系统及版本 */ system: string - /** 系统当前主题,取值为`light`或`dark`,全局配置`"darkmode":true`时才能获取,否则为 undefined (不支持小游戏) - * - * 最低基础库: `2.11.0` */ - theme: string /** 微信版本号 */ version: string /** Wi-Fi 的系统开关 @@ -2314,6 +2291,14 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb windowHeight: number /** 可使用窗口宽度,单位px */ windowWidth: number + /** 系统当前主题,取值为`light`或`dark`,全局配置`"darkmode":true`时才能获取,否则为 undefined (不支持小游戏) + * + * 可选值: + * - 'dark': 深色主题; + * - 'light': 浅色主题; + * + * 最低基础库: `2.11.0` */ + theme?: 'dark' | 'light' errMsg: string } interface GetSystemInfoSyncResult { @@ -2399,10 +2384,6 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb statusBarHeight: number /** 操作系统及版本 */ system: string - /** 系统当前主题,取值为`light`或`dark`,全局配置`"darkmode":true`时才能获取,否则为 undefined (不支持小游戏) - * - * 最低基础库: `2.11.0` */ - theme: string /** 微信版本号 */ version: string /** Wi-Fi 的系统开关 @@ -2413,6 +2394,14 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb windowHeight: number /** 可使用窗口宽度,单位px */ windowWidth: number + /** 系统当前主题,取值为`light`或`dark`,全局配置`"darkmode":true`时才能获取,否则为 undefined (不支持小游戏) + * + * 可选值: + * - 'dark': 深色主题; + * - 'light': 浅色主题; + * + * 最低基础库: `2.11.0` */ + theme?: 'dark' | 'light' } interface GetUserInfoOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ @@ -2882,7 +2871,6 @@ innerAudioContext.onError((res) => { /** 制造商信息 */ manufacturerSpecificData?: ArrayBuffer } - /** 要显示在可视区域内的坐标点列表 */ interface MapPostion { /** 纬度 */ latitude: number @@ -3159,7 +3147,7 @@ innerAudioContext.onError((res) => { } interface OnBluetoothDeviceFoundCallbackResult { /** 新搜索到的设备列表 */ - devices: CallbackResultBlueToothDevice[] + devices: BlueToothDevice[] } interface OnCameraFrameCallbackResult { /** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */ @@ -3339,8 +3327,12 @@ innerAudioContext.onError((res) => { tempFilePath: string } interface OnThemeChangeCallbackResult { - /** 系统当前的主题,取值为`light`或`dark` */ - theme: string + /** 系统当前的主题,取值为`light`或`dark` + * + * 可选值: + * - 'dark': 深色主题; + * - 'light': 浅色主题; */ + theme: 'dark' | 'light' } interface OnUnhandledRejectionCallbackResult { /** 被拒绝的 Promise 对象 */ @@ -5611,18 +5603,9 @@ innerAudioContext.onError((res) => { } interface WxGetSavedFileListSuccessCallbackResult { /** 文件数组,每一项是一个 FileItem */ - fileList: WxGetSavedFileListSuccessCallbackResultFileItem[] + fileList: FileItem[] errMsg: string } - /** 文件数组,每一项是一个 FileItem */ - interface WxGetSavedFileListSuccessCallbackResultFileItem { - /** 文件保存时的时间戳,从1970/01/01 08:00:00 到当前时间的秒数 */ - createTime: number - /** 文件路径 (本地路径) */ - filePath: string - /** 本地文件大小,以字节为单位 */ - size: number - } interface WxRemoveSavedFileOption { /** 需要删除的文件路径 (本地路径) */ filePath: string @@ -6013,14 +5996,14 @@ innerAudioContext.onError((res) => { * 监听背景音频进入可播放状态事件。 但不保证后面可以流畅播放 */ onCanplay( /** 背景音频进入可播放状态事件的回调函数 */ - callback: BackgroundAudioManagerOnCanplayCallback + callback: OnCanplayCallback ): void /** [BackgroundAudioManager.onEnded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onEnded.html) * * 监听背景音频自然播放结束事件 */ onEnded( /** 背景音频自然播放结束事件的回调函数 */ - callback: BackgroundAudioManagerOnEndedCallback + callback: OnEndedCallback ): void /** [BackgroundAudioManager.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onError.html) * @@ -6041,14 +6024,14 @@ innerAudioContext.onError((res) => { * 监听背景音频暂停事件 */ onPause( /** 背景音频暂停事件的回调函数 */ - callback: BackgroundAudioManagerOnPauseCallback + callback: OnPauseCallback ): void /** [BackgroundAudioManager.onPlay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPlay.html) * * 监听背景音频播放事件 */ onPlay( /** 背景音频播放事件的回调函数 */ - callback: BackgroundAudioManagerOnPlayCallback + callback: OnPlayCallback ): void /** [BackgroundAudioManager.onPrev(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPrev.html) * @@ -6062,28 +6045,28 @@ innerAudioContext.onError((res) => { * 监听背景音频完成跳转操作事件 */ onSeeked( /** 背景音频完成跳转操作事件的回调函数 */ - callback: BackgroundAudioManagerOnSeekedCallback + callback: OnSeekedCallback ): void /** [BackgroundAudioManager.onSeeking(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onSeeking.html) * * 监听背景音频开始跳转操作事件 */ onSeeking( /** 背景音频开始跳转操作事件的回调函数 */ - callback: BackgroundAudioManagerOnSeekingCallback + callback: OnSeekingCallback ): void /** [BackgroundAudioManager.onStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onStop.html) * * 监听背景音频停止事件 */ onStop( /** 背景音频停止事件的回调函数 */ - callback: BackgroundAudioManagerOnStopCallback + callback: InnerAudioContextOnStopCallback ): void /** [BackgroundAudioManager.onTimeUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onTimeUpdate.html) * * 监听背景音频播放进度更新事件,只有小程序在前台时会回调。 */ onTimeUpdate( /** 背景音频播放进度更新事件的回调函数 */ - callback: BackgroundAudioManagerOnTimeUpdateCallback + callback: OnTimeUpdateCallback ): void /** [BackgroundAudioManager.onWaiting(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onWaiting.html) * @@ -8430,14 +8413,14 @@ this.editorCtx.insertImage({ * 监听音频进入可以播放状态的事件。但不保证后面可以流畅播放 */ onCanplay( /** 音频进入可以播放状态的事件的回调函数 */ - callback: InnerAudioContextOnCanplayCallback + callback: OnCanplayCallback ): void /** [InnerAudioContext.onEnded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onEnded.html) * * 监听音频自然播放至结束的事件 */ onEnded( /** 音频自然播放至结束的事件的回调函数 */ - callback: InnerAudioContextOnEndedCallback + callback: OnEndedCallback ): void /** [InnerAudioContext.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onError.html) * @@ -8451,28 +8434,28 @@ this.editorCtx.insertImage({ * 监听音频暂停事件 */ onPause( /** 音频暂停事件的回调函数 */ - callback: InnerAudioContextOnPauseCallback + callback: OnPauseCallback ): void /** [InnerAudioContext.onPlay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onPlay.html) * * 监听音频播放事件 */ onPlay( /** 音频播放事件的回调函数 */ - callback: InnerAudioContextOnPlayCallback + callback: OnPlayCallback ): void /** [InnerAudioContext.onSeeked(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onSeeked.html) * * 监听音频完成跳转操作的事件 */ onSeeked( /** 音频完成跳转操作的事件的回调函数 */ - callback: InnerAudioContextOnSeekedCallback + callback: OnSeekedCallback ): void /** [InnerAudioContext.onSeeking(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onSeeking.html) * * 监听音频进行跳转操作的事件 */ onSeeking( /** 音频进行跳转操作的事件的回调函数 */ - callback: InnerAudioContextOnSeekingCallback + callback: OnSeekingCallback ): void /** [InnerAudioContext.onStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onStop.html) * @@ -8486,7 +8469,7 @@ this.editorCtx.insertImage({ * 监听音频播放进度更新事件 */ onTimeUpdate( /** 音频播放进度更新事件的回调函数 */ - callback: InnerAudioContextOnTimeUpdateCallback + callback: OnTimeUpdateCallback ): void /** [InnerAudioContext.onWaiting(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onWaiting.html) * @@ -8577,7 +8560,7 @@ Page({ * 取消监听插屏广告关闭事件 */ offClose( /** 插屏广告关闭事件的回调函数 */ - callback: InterstitialAdOffCloseCallback + callback: UDPSocketOffCloseCallback ): void /** [InterstitialAd.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offError.html) * @@ -8591,14 +8574,14 @@ Page({ * 取消监听插屏广告加载事件 */ offLoad( /** 插屏广告加载事件的回调函数 */ - callback: InterstitialAdOffLoadCallback + callback: OffLoadCallback ): void /** [InterstitialAd.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onClose.html) * * 监听插屏广告关闭事件。 */ onClose( /** 插屏广告关闭事件的回调函数 */ - callback: InterstitialAdOnCloseCallback + callback: UDPSocketOnCloseCallback ): void /** [InterstitialAd.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onError.html) * @@ -8630,7 +8613,7 @@ Page({ * 监听插屏广告加载事件。 */ onLoad( /** 插屏广告加载事件的回调函数 */ - callback: InterstitialAdOnLoadCallback + callback: OnLoadCallback ): void /** [Promise InterstitialAd.load()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.load.html) * @@ -9286,7 +9269,7 @@ Page({ * 监听录音错误事件 */ onError( /** 录音错误事件的回调函数 */ - callback: RecorderManagerOnErrorCallback + callback: UDPSocketOnErrorCallback ): void /** [RecorderManager.onFrameRecorded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onFrameRecorded.html) * @@ -9318,7 +9301,7 @@ Page({ * 监听录音暂停事件 */ onPause( /** 录音暂停事件的回调函数 */ - callback: RecorderManagerOnPauseCallback + callback: OnPauseCallback ): void /** [RecorderManager.onResume(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onResume.html) * @@ -9435,7 +9418,7 @@ Page({ * 取消监听激励视频广告加载事件 */ offLoad( /** 激励视频广告加载事件的回调函数 */ - callback: RewardedVideoAdOffLoadCallback + callback: OffLoadCallback ): void /** [RewardedVideoAd.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onClose.html) * @@ -9474,7 +9457,7 @@ Page({ * 监听激励视频广告加载事件。 */ onLoad( /** 激励视频广告加载事件的回调函数 */ - callback: RewardedVideoAdOnLoadCallback + callback: OnLoadCallback ): void } interface SelectorQuery { @@ -9568,7 +9551,7 @@ Component({ * 监听 WebSocket 错误事件 */ onError( /** WebSocket 错误事件的回调函数 */ - callback: SocketTaskOnErrorCallback + callback: UDPSocketOnErrorCallback ): void /** [SocketTask.onMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onMessage.html) * @@ -11575,7 +11558,7 @@ wx.getSetting({ * * 最低基础库: `1.2.0` */ getSetting( - option: TOption + option?: TOption ): PromisifySuccessResult /** [wx.getShareInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.getShareInfo.html) * @@ -14821,42 +14804,10 @@ wx.writeBLECharacteristicValue({ type AuthorizeFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type AuthorizeSuccessCallback = (res: GeneralCallbackResult) => void - /** 背景音频进入可播放状态事件的回调函数 */ - type BackgroundAudioManagerOnCanplayCallback = ( - res: GeneralCallbackResult - ) => void - /** 背景音频自然播放结束事件的回调函数 */ - type BackgroundAudioManagerOnEndedCallback = ( - res: GeneralCallbackResult - ) => void /** 背景音频播放错误事件的回调函数 */ type BackgroundAudioManagerOnErrorCallback = ( res: GeneralCallbackResult ) => void - /** 背景音频暂停事件的回调函数 */ - type BackgroundAudioManagerOnPauseCallback = ( - res: GeneralCallbackResult - ) => void - /** 背景音频播放事件的回调函数 */ - type BackgroundAudioManagerOnPlayCallback = ( - res: GeneralCallbackResult - ) => void - /** 背景音频完成跳转操作事件的回调函数 */ - type BackgroundAudioManagerOnSeekedCallback = ( - res: GeneralCallbackResult - ) => void - /** 背景音频开始跳转操作事件的回调函数 */ - type BackgroundAudioManagerOnSeekingCallback = ( - res: GeneralCallbackResult - ) => void - /** 背景音频停止事件的回调函数 */ - type BackgroundAudioManagerOnStopCallback = ( - res: GeneralCallbackResult - ) => void - /** 背景音频播放进度更新事件的回调函数 */ - type BackgroundAudioManagerOnTimeUpdateCallback = ( - res: GeneralCallbackResult - ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type BlurCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ @@ -15557,34 +15508,11 @@ wx.writeBLECharacteristicValue({ type InnerAudioContextOffErrorCallback = ( result: InnerAudioContextOnErrorCallbackResult ) => void - /** 音频进入可以播放状态的事件的回调函数 */ - type InnerAudioContextOnCanplayCallback = ( - res: GeneralCallbackResult - ) => void - /** 音频自然播放至结束的事件的回调函数 */ - type InnerAudioContextOnEndedCallback = (res: GeneralCallbackResult) => void /** 音频播放错误事件的回调函数 */ type InnerAudioContextOnErrorCallback = ( result: InnerAudioContextOnErrorCallbackResult ) => void - /** 音频暂停事件的回调函数 */ - type InnerAudioContextOnPauseCallback = (res: GeneralCallbackResult) => void - /** 音频播放事件的回调函数 */ - type InnerAudioContextOnPlayCallback = (res: GeneralCallbackResult) => void - /** 音频完成跳转操作的事件的回调函数 */ - type InnerAudioContextOnSeekedCallback = ( - res: GeneralCallbackResult - ) => void - /** 音频进行跳转操作的事件的回调函数 */ - type InnerAudioContextOnSeekingCallback = ( - res: GeneralCallbackResult - ) => void - /** 音频停止事件的回调函数 */ type InnerAudioContextOnStopCallback = (res: GeneralCallbackResult) => void - /** 音频播放进度更新事件的回调函数 */ - type InnerAudioContextOnTimeUpdateCallback = ( - res: GeneralCallbackResult - ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type InsertDividerCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ @@ -15603,22 +15531,14 @@ wx.writeBLECharacteristicValue({ type InsertTextFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type InsertTextSuccessCallback = (res: GeneralCallbackResult) => void - /** 插屏广告关闭事件的回调函数 */ - type InterstitialAdOffCloseCallback = (res: GeneralCallbackResult) => void /** 插屏错误事件的回调函数 */ type InterstitialAdOffErrorCallback = ( result: InterstitialAdOnErrorCallbackResult ) => void - /** 插屏广告加载事件的回调函数 */ - type InterstitialAdOffLoadCallback = (res: GeneralCallbackResult) => void - /** 插屏广告关闭事件的回调函数 */ - type InterstitialAdOnCloseCallback = (res: GeneralCallbackResult) => void /** 插屏错误事件的回调函数 */ type InterstitialAdOnErrorCallback = ( result: InterstitialAdOnErrorCallbackResult ) => void - /** 插屏广告加载事件的回调函数 */ - type InterstitialAdOnLoadCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type LoadFontFaceCompleteCallback = ( result: LoadFontFaceCompleteCallbackResult @@ -15751,6 +15671,7 @@ wx.writeBLECharacteristicValue({ ) => void /** 开始监听数据包消息的事件的回调函数 */ type OffListeningCallback = (res: GeneralCallbackResult) => void + type OffLoadCallback = (res: GeneralCallbackResult) => void /** mDNS 服务停止搜索的事件的回调函数 */ type OffLocalServiceDiscoveryStopCallback = ( res: GeneralCallbackResult @@ -15864,6 +15785,7 @@ wx.writeBLECharacteristicValue({ ) => void /** 回调函数 */ type OnCameraFrameCallback = (result: OnCameraFrameCallbackResult) => void + type OnCanplayCallback = (res: GeneralCallbackResult) => void /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ type OnCharacteristicReadRequestCallback = ( result: OnCharacteristicReadRequestCallbackResult @@ -15884,6 +15806,7 @@ wx.writeBLECharacteristicValue({ type OnDeviceMotionChangeCallback = ( result: OnDeviceMotionChangeCallbackResult ) => void + type OnEndedCallback = (res: GeneralCallbackResult) => void /** 已录制完指定帧大小的文件事件的回调函数 */ type OnFrameRecordedCallback = ( result: OnFrameRecordedCallbackResult @@ -15909,6 +15832,7 @@ wx.writeBLECharacteristicValue({ ) => void /** 开始监听数据包消息的事件的回调函数 */ type OnListeningCallback = (res: GeneralCallbackResult) => void + type OnLoadCallback = (res: GeneralCallbackResult) => void /** mDNS 服务停止搜索的事件的回调函数 */ type OnLocalServiceDiscoveryStopCallback = ( res: GeneralCallbackResult @@ -15943,10 +15867,14 @@ wx.writeBLECharacteristicValue({ type OnOpenCallback = (result: OnOpenCallbackResult) => void /** 小程序要打开的页面不存在事件的回调函数 */ type OnPageNotFoundCallback = (result: OnPageNotFoundCallbackResult) => void + type OnPauseCallback = (res: GeneralCallbackResult) => void + type OnPlayCallback = (res: GeneralCallbackResult) => void /** 用户在系统音乐播放面板点击上一曲事件的回调函数 */ type OnPrevCallback = (res: GeneralCallbackResult) => void /** 录音继续事件的回调函数 */ type OnResumeCallback = (res: GeneralCallbackResult) => void + type OnSeekedCallback = (res: GeneralCallbackResult) => void + type OnSeekingCallback = (res: GeneralCallbackResult) => void /** WebSocket 连接关闭事件的回调函数 */ type OnSocketCloseCallback = ( result: SocketTaskOnCloseCallbackResult @@ -15965,6 +15893,7 @@ wx.writeBLECharacteristicValue({ type OnStartCallback = (res: GeneralCallbackResult) => void /** 系统主题改变事件的回调函数 */ type OnThemeChangeCallback = (result: OnThemeChangeCallbackResult) => void + type OnTimeUpdateCallback = (res: GeneralCallbackResult) => void /** 未处理的 Promise 拒绝事件的回调函数 */ type OnUnhandledRejectionCallback = ( result: OnUnhandledRejectionCallbackResult @@ -16113,12 +16042,6 @@ wx.writeBLECharacteristicValue({ type ReaddirFailCallback = (result: ReaddirFailCallbackResult) => void /** 接口调用成功的回调函数 */ type ReaddirSuccessCallback = (result: ReaddirSuccessCallbackResult) => void - /** 录音错误事件的回调函数 */ - type RecorderManagerOnErrorCallback = ( - result: UDPSocketOnErrorCallbackResult - ) => void - /** 录音暂停事件的回调函数 */ - type RecorderManagerOnPauseCallback = (res: GeneralCallbackResult) => void /** 录音结束事件的回调函数 */ type RecorderManagerOnStopCallback = (result: OnStopCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ @@ -16221,8 +16144,6 @@ wx.writeBLECharacteristicValue({ type RewardedVideoAdOffErrorCallback = ( result: RewardedVideoAdOnErrorCallbackResult ) => void - /** 激励视频广告加载事件的回调函数 */ - type RewardedVideoAdOffLoadCallback = (res: GeneralCallbackResult) => void /** 用户点击 `关闭广告` 按钮的事件的回调函数 */ type RewardedVideoAdOnCloseCallback = ( result: RewardedVideoAdOnCloseCallbackResult @@ -16231,8 +16152,6 @@ wx.writeBLECharacteristicValue({ type RewardedVideoAdOnErrorCallback = ( result: RewardedVideoAdOnErrorCallbackResult ) => void - /** 激励视频广告加载事件的回调函数 */ - type RewardedVideoAdOnLoadCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type RmdirCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ @@ -16553,10 +16472,6 @@ wx.writeBLECharacteristicValue({ type SocketTaskOnCloseCallback = ( result: SocketTaskOnCloseCallbackResult ) => void - /** WebSocket 错误事件的回调函数 */ - type SocketTaskOnErrorCallback = ( - result: UDPSocketOnErrorCallbackResult - ) => void /** WebSocket 接受到服务器的消息事件的回调函数 */ type SocketTaskOnMessageCallback = ( result: SocketTaskOnMessageCallbackResult @@ -16877,15 +16792,12 @@ wx.writeBLECharacteristicValue({ type TranslateMarkerFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type TranslateMarkerSuccessCallback = (res: GeneralCallbackResult) => void - /** 关闭事件的回调函数 */ type UDPSocketOffCloseCallback = (res: GeneralCallbackResult) => void /** 错误事件的回调函数 */ type UDPSocketOffErrorCallback = ( result: UDPSocketOnErrorCallbackResult ) => void - /** 关闭事件的回调函数 */ type UDPSocketOnCloseCallback = (res: GeneralCallbackResult) => void - /** 错误事件的回调函数 */ type UDPSocketOnErrorCallback = ( result: UDPSocketOnErrorCallbackResult ) => void diff --git a/types/wx/lib.wx.app.d.ts b/types/wx/lib.wx.app.d.ts index 818becf..e180e0a 100644 --- a/types/wx/lib.wx.app.d.ts +++ b/types/wx/lib.wx.app.d.ts @@ -236,6 +236,12 @@ declare namespace WechatMiniprogram { * **参数**:与 [wx.onUnhandledRejection](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html) 一致 */ onUnhandledRejection: OnUnhandledRejectionCallback + /** + * 系统切换主题时触发。也可以使用 wx.onThemeChange 绑定监听。 + * + * 最低基础库: 2.11.0 + */ + onThemeChange: OnThemeChangeCallback } type Instance = Option & T diff --git a/types/wx/lib.wx.component.d.ts b/types/wx/lib.wx.component.d.ts index 837a30c..2a4e18f 100644 --- a/types/wx/lib.wx.component.d.ts +++ b/types/wx/lib.wx.component.d.ts @@ -25,34 +25,55 @@ declare namespace WechatMiniprogram { type Instance< TData extends DataOption, TProperty extends PropertyOption, - TMethod extends Partial + TMethod extends Partial, + TCustomInstanceProperty extends IAnyObject = {} > = InstanceProperties & InstanceMethods & - TMethod & { + TMethod & + TCustomInstanceProperty & { /** 组件数据,**包括内部数据和属性值** */ data: TData & PropertyOptionToData /** 组件数据,**包括内部数据和属性值**(与 `data` 一致) */ properties: TData & PropertyOptionToData } - type TrivialInstance = Instance - type TrivialOption = Options + type TrivialInstance = Instance< + IAnyObject, + IAnyObject, + IAnyObject, + IAnyObject + > + type TrivialOption = Options< + IAnyObject, + IAnyObject, + IAnyObject, + IAnyObject + > type Options< TData extends DataOption, TProperty extends PropertyOption, - TMethod extends MethodOption + TMethod extends MethodOption, + TCustomInstanceProperty extends IAnyObject = {} > = Partial> & Partial> & Partial> & Partial & Partial & - ThisType> + ThisType< + Instance + > interface Constructor { < TData extends DataOption, TProperty extends PropertyOption, - TMethod extends MethodOption + TMethod extends MethodOption, + TCustomInstanceProperty extends IAnyObject = {} >( - options: Options + options: Options< + TData, + TProperty, + TMethod, + TCustomInstanceProperty + > ): string } type DataOption = Record diff --git a/types/wx/lib.wx.page.d.ts b/types/wx/lib.wx.page.d.ts index 55e1084..396cbf4 100644 --- a/types/wx/lib.wx.page.d.ts +++ b/types/wx/lib.wx.page.d.ts @@ -120,6 +120,14 @@ declare namespace WechatMiniprogram { /** 窗口尺寸参数 */ options: IResizeOption ): void + + /** + * 监听用户点击右上角菜单“收藏”按钮的行为,并自定义收藏内容。 + * 基础库 2.10.3,安卓 7.0.15 版本起支持,iOS 暂不支持 + */ + onAddToFavorites( + options: IAddToFavoritesOption + ): IAddToFavoritesContent } interface InstanceProperties { /** 页面的文件路径 */ @@ -204,6 +212,20 @@ declare namespace WechatMiniprogram { } } + interface IAddToFavoritesOption { + /** 页面中包含web-view组件时,返回当前web-view的url */ + webviewUrl?: string + } + + interface IAddToFavoritesContent { + /** 自定义标题,默认值:页面标题或账号名称 */ + title?: string + /** 自定义图片,显示图片长宽比为 1:1,默认值:页面截图 */ + imageUrl?: string + /** 自定义query字段,默认值:当前页面的query */ + query?: string + } + interface getCurrentPages { (): Array> } From 3c473cbb8370bb1050858a5ea1d718999c1ed297 Mon Sep 17 00:00:00 2001 From: wechat-miniprogram-admin Date: Wed, 15 Jul 2020 19:05:24 +0800 Subject: [PATCH 019/205] 2.11.0-1 --- VERSIONS.md | 2 +- package.json | 2 +- types/wx/lib.wx.api.d.ts | 1169 ++++++++++++++++++++++++++++++++---- types/wx/lib.wx.cloud.d.ts | 39 +- types/wx/lib.wx.page.d.ts | 2 +- 5 files changed, 1087 insertions(+), 127 deletions(-) diff --git a/VERSIONS.md b/VERSIONS.md index cc6d558..0417172 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -21,4 +21,4 @@ [v2.6.5](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-6-5-2019-04-02) | [2.6.5-2](https://www.npmjs.com/package/miniprogram-api-typings/v/2.6.5-2) | `npm install miniprogram-api-typings@2.6.5-2` [v2.4.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/v2.html#v2-4-2-2018-12-04)|[2.4.2-2](https://www.npmjs.com/package/miniprogram-api-typings/v/2.4.2-2)|`npm install miniprogram-api-typings@2.4.2-2` [v2.4.1](https://developers.weixin.qq.com/miniprogram/dev/framework/release/v2.html#v2-4-1-2018-11-21)|[2.4.1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.4.1)|`npm install miniprogram-api-typings@2.4.1` -[v2.4.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/v2.html#v2-4-0-2018-11-05)|[2.4.0-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.4.0-1)|`npm install miniprogram-api-typings@2.4.0-1` \ No newline at end of file +[v2.4.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/v2.html#v2-4-0-2018-11-05)|[2.4.0-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.4.0-1)|`npm install miniprogram-api-typings@2. \ No newline at end of file diff --git a/package.json b/package.json index 5917feb..1712e58 100644 --- a/package.json +++ b/package.json @@ -38,4 +38,4 @@ "typings.json", "types/" ] -} +} \ No newline at end of file diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index 84c9627..c24f915 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -281,14 +281,6 @@ declare namespace WechatMiniprogram { /** 该特征值是否支持 write 操作 */ write: boolean } - interface BLEPeripheralServerCloseOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: CloseCompleteCallback - /** 接口调用失败的回调函数 */ - fail?: CloseFailCallback - /** 接口调用成功的回调函数 */ - success?: CloseSuccessCallback - } /** 描述service的Object */ interface BLEPeripheralService { /** characteristics列表 */ @@ -632,7 +624,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** Characteristic 的 uuid */ uuid: string /** 描述符数据 */ - descriptors?: Descriptor[] + descriptors?: CharacteristicDescriptor[] /** 特征值权限 */ permission?: CharacteristicPermission /** 特征值支持的操作 */ @@ -640,6 +632,15 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 特征值对应的二进制值 */ value?: ArrayBuffer } + /** 描述符数据 */ + interface CharacteristicDescriptor { + /** Descriptor 的 uuid */ + uuid: string + /** 描述符的权限 */ + permission?: DescriptorPermission + /** 描述符数据 */ + value?: ArrayBuffer + } /** 特征值权限 */ interface CharacteristicPermission { /** 加密读请求 */ @@ -1215,6 +1216,14 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb tempFilePath: string errMsg: string } + interface ConnectOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ConnectCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ConnectFailCallback + /** 接口调用成功的回调函数 */ + success?: ConnectSuccessCallback + } interface ConnectSocketOption { /** 开发者服务器 wss 接口地址 */ url: string @@ -1303,7 +1312,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb success?: CreateBLEPeripheralServerSuccessCallback } interface CreateBLEPeripheralServerSuccessCallbackResult { - /** [BLEPeripheralServer](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.html) + /** [BLEPeripheralServer](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.html) * * 外围设备的服务端。 */ server: BLEPeripheralServer @@ -1358,15 +1367,6 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 字体粗细,可选值为 normal / bold / 100 / 200../ 900 */ weight?: string } - /** 描述符数据 */ - interface Descriptor { - /** Descriptor 的 uuid */ - uuid: string - /** 描述符的权限 */ - permission?: DescriptorPermission - /** 描述符数据 */ - value?: ArrayBuffer - } /** 描述符的权限 */ interface DescriptorPermission { /** 读 */ @@ -1491,6 +1491,14 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 接口调用成功的回调函数 */ success?: ExitPictureInPictureSuccessCallback } + interface ExitVoIPChatOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ExitVoIPChatCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ExitVoIPChatFailCallback + /** 接口调用成功的回调函数 */ + success?: ExitVoIPChatSuccessCallback + } interface ExtractDataSourceOption { /** 视频源地址,只支持本地文件 */ source: string @@ -1586,6 +1594,32 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb savedFilePath: string errMsg: string } + /** 视频帧数据,若取不到则返回 null。当缓存区满的时候可能暂停取不到数据。 */ + interface FrameDataOptions { + /** 帧数据 */ + data: ArrayBuffer + /** 帧数据高度 */ + height: number + /** 帧原始 dts */ + pkDts: number + /** 帧原始 pts */ + pkPts: number + /** 帧数据宽度 */ + width: number + } + interface GetAtqaOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetAtqaCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetAtqaFailCallback + /** 接口调用成功的回调函数 */ + success?: GetAtqaSuccessCallback + } + interface GetAtqaSuccessCallbackResult { + /** 返回 ATQA/SENS_RES 数据 */ + atqa: ArrayBuffer + errMsg: string + } interface GetAvailableAudioSourcesOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: GetAvailableAudioSourcesCompleteCallback @@ -1871,6 +1905,19 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 接口调用成功的回调函数 */ success?: GetHCEStateSuccessCallback } + interface GetHistoricalBytesOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetHistoricalBytesCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetHistoricalBytesFailCallback + /** 接口调用成功的回调函数 */ + success?: GetHistoricalBytesSuccessCallback + } + interface GetHistoricalBytesSuccessCallbackResult { + /** 返回历史二进制数据 */ + histBytes: ArrayBuffer + errMsg: string + } interface GetImageInfoOption { /** 图片的路径,支持网络路径、本地路径、代码包路径 */ src: string @@ -1967,6 +2014,19 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb * 最低基础库: `2.3.2` */ level?: number } + interface GetMaxTransceiveLengthOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetMaxTransceiveLengthCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetMaxTransceiveLengthFailCallback + /** 接口调用成功的回调函数 */ + success?: GetMaxTransceiveLengthSuccessCallback + } + interface GetMaxTransceiveLengthSuccessCallbackResult { + /** 最大传输长度 */ + length: number + errMsg: string + } interface GetNetworkTypeOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: GetNetworkTypeCompleteCallback @@ -2017,6 +2077,19 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb rotate: number errMsg: string } + interface GetSakOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetSakCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetSakFailCallback + /** 接口调用成功的回调函数 */ + success?: GetSakSuccessCallback + } + interface GetSakSuccessCallbackResult { + /** 返回 SAK/SEL_RES 数据 */ + sak: number + errMsg: string + } interface GetSavedFileInfoOption { /** 文件路径 (本地路径) */ filePath: string @@ -2755,6 +2828,18 @@ innerAudioContext.onError((res) => { /** 文本内容 */ text?: string } + interface IntersectionObserverObserveCallbackResult { + /** 目标边界 */ + boundingClientRect: BoundingClientRectResult + /** 相交比例 */ + intersectionRatio: number + /** 相交区域的边界 */ + intersectionRect: IntersectionRectResult + /** 参照区域的边界 */ + relativeRect: RelativeRectResult + /** 相交检测时的时间戳 */ + time: number + } /** 相交区域的边界 */ interface IntersectionRectResult { /** 下边界 */ @@ -2787,6 +2872,49 @@ innerAudioContext.onError((res) => { /** 错误信息 */ errMsg: string } + interface IsConnectedOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: IsConnectedCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: IsConnectedFailCallback + /** 接口调用成功的回调函数 */ + success?: IsConnectedSuccessCallback + } + interface IsConnectedSuccessCallbackResult { + /** 是否连接 */ + connected: boolean + errMsg: string + } + interface JoinVoIPChatOption { + /** 小游戏内此房间/群聊的 ID。同一时刻传入相同 groupId 的用户会进入到同个实时语音房间。 */ + groupId: string + /** 验证所需的随机字符串 */ + nonceStr: string + /** 签名,用于验证小游戏的身份 */ + signature: string + /** 验证所需的时间戳 */ + timeStamp: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: JoinVoIPChatCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: JoinVoIPChatFailCallback + /** 语音通话是否免提 + * + * 最低基础库: `2.10.4` */ + handsFree?: boolean + /** 静音设置 */ + muteConfig?: MuteConfig + /** 接口调用成功的回调函数 */ + success?: JoinVoIPChatSuccessCallback + } + interface JoinVoIPChatSuccessCallbackResult { + /** 错误码 */ + errCode: number + /** 调用结果 */ + errMsg: string + /** 在此通话中的成员 openId 名单 */ + openIdList: string[] + } /** 启动参数 */ interface LaunchOptionsApp { /** 启动小程序的路径 (代码包路径) */ @@ -2903,6 +3031,10 @@ innerAudioContext.onError((res) => { /** 视频的宽度 */ width: number } + interface MediaQueryObserverObserveCallbackResult { + /** 页面的当前状态是否满足所指定的 media query */ + matches: boolean + } /** 可通过 [MediaContainer.extractDataSource](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.extractDataSource.html) 返回。 * * [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) 音频或视频轨道,可以对轨道进行一些操作 @@ -2977,6 +3109,13 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: MoveToLocationSuccessCallback } + /** 静音设置 */ + interface MuteConfig { + /** 是否静音耳机 */ + muteEarphone?: boolean + /** 是否静音麦克风 */ + muteMicrophone?: boolean + } interface MuteOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: MuteCompleteCallback @@ -2985,6 +3124,13 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: MuteSuccessCallback } + /** + * + * 最低基础库: `2.11.2` */ + interface NFCAdapter { + /** 标签类型枚举 */ + tech: TechType + } interface NavigateBackMiniProgramOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: NavigateBackMiniProgramCompleteCallback @@ -3045,6 +3191,14 @@ innerAudioContext.onError((res) => { eventChannel: EventChannel errMsg: string } + interface NdefCloseOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CloseCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: CloseFailCallback + /** 接口调用成功的回调函数 */ + success?: CloseSuccessCallback + } interface NodeCallbackResult { /** 节点对应的 Node 实例 */ node: IAnyObject @@ -3065,17 +3219,22 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: NotifyBLECharacteristicValueChangeSuccessCallback } - interface ObserveCallbackResult { - /** 目标边界 */ - boundingClientRect: BoundingClientRectResult - /** 相交比例 */ - intersectionRatio: number - /** 相交区域的边界 */ - intersectionRect: IntersectionRectResult - /** 参照区域的边界 */ - relativeRect: RelativeRectResult - /** 相交检测时的时间戳 */ - time: number + /** media query 描述符 */ + interface ObserveDescriptor { + /** 页面高度( px 为单位) */ + height: number + /** 页面最大高度( px 为单位) */ + maxHeight: number + /** 页面最大宽度( px 为单位) */ + maxWidth: number + /** 页面最小高度( px 为单位) */ + minHeight: number + /** 页面最小宽度( px 为单位) */ + minWidth: number + /** 屏幕方向( `landscape` 或 `portrait` ) */ + orientation: string + /** 页面宽度( px 为单位) */ + width: number } interface OnAccelerometerChangeCallbackResult { /** X 轴 */ @@ -3294,6 +3453,14 @@ innerAudioContext.onError((res) => { * - 'none': 无网络; */ networkType: 'wifi' | '2g' | '3g' | '4g' | 'unknown' | 'none' } + interface OnOnVoIPVideoMembersChangedCallbackResult { + /** 错误码 */ + errCode: number + /** 调用结果 */ + errMsg: string + /** 开启视频的成员 openId 名单 */ + openIdList: string[] + } interface OnOpenCallbackResult { /** 连接成功的 HTTP 响应 Header * @@ -3340,6 +3507,28 @@ innerAudioContext.onError((res) => { /** 拒绝原因,一般是一个 Error 对象 */ reason: string } + interface OnVoIPChatInterruptedCallbackResult { + /** 错误码 */ + errCode: number + /** 调用结果(错误原因) */ + errMsg: string + } + interface OnVoIPChatMembersChangedCallbackResult { + /** 错误码 */ + errCode: number + /** 调用结果 */ + errMsg: string + /** 还在实时语音通话中的成员 openId 名单 */ + openIdList: string[] + } + interface OnVoIPChatSpeakersChangedCallbackResult { + /** 错误码 */ + errCode: number + /** 调用结果(错误原因) */ + errMsg: string + /** 还在实时语音通话中的成员 openId 名单 */ + openIdList: string[] + } interface OnWifiConnectedCallbackResult { /** [WifiInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/WifiInfo.html) * @@ -3358,7 +3547,7 @@ innerAudioContext.onError((res) => { * * 可选值: * - 'central': 主机模式; - * - 'peripheral': 丛机模式; + * - 'peripheral': 从机模式; * * 最低基础库: `2.10.0` */ mode?: 'central' | 'peripheral' @@ -4532,6 +4721,16 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: SetTabBarStyleSuccessCallback } + interface SetTimeoutOption { + /** 设置超时时间 (ms) */ + timeout: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetTimeoutCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetTimeoutFailCallback + /** 接口调用成功的回调函数 */ + success?: SetTimeoutSuccessCallback + } interface SetTopBarTextOption { /** 置顶栏文字 */ text: string @@ -4820,6 +5019,13 @@ innerAudioContext.onError((res) => { fail?: StartBluetoothDevicesDiscoveryFailCallback /** 上报设备的间隔。0 表示找到新设备立即上报,其他数值根据传入的间隔上报。 */ interval?: number + /** 扫描模式,越高扫描越快,也越耗电, 仅安卓 7.0.12 及以上支持。 + * + * 可选值: + * - 'low': 低; + * - 'medium': 中; + * - 'high': 高; */ + powerLevel?: 'low' | 'medium' | 'high' /** 要搜索的蓝牙设备主 service 的 uuid 列表。某些蓝牙设备会广播自己的主 service 的 uuid。如果设置此参数,则只搜索广播包有对应 uuid 的主服务的蓝牙设备。建议主要通过该参数过滤掉周边不需要处理的其他蓝牙设备。 */ services?: string[] /** 接口调用成功的回调函数 */ @@ -4848,6 +5054,14 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: StartDeviceMotionListeningSuccessCallback } + interface StartDiscoveryOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartDiscoveryCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartDiscoveryFailCallback + /** 接口调用成功的回调函数 */ + success?: StartDiscoverySuccessCallback + } interface StartGyroscopeOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: StartGyroscopeCompleteCallback @@ -5102,6 +5316,14 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: StopDeviceMotionListeningSuccessCallback } + interface StopDiscoveryOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopDiscoveryCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopDiscoveryFailCallback + /** 接口调用成功的回调函数 */ + success?: StopDiscoverySuccessCallback + } interface StopGyroscopeOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: StopGyroscopeCompleteCallback @@ -5188,6 +5410,14 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: StopWifiSuccessCallback } + interface SubscribeVoIPVideoMembersOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SubscribeVoIPVideoMembersCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SubscribeVoIPVideoMembersFailCallback + /** 接口调用成功的回调函数 */ + success?: SubscribeVoIPVideoMembersSuccessCallback + } /** 订阅消息设置 */ interface SubscriptionsSetting { /** 每一项订阅消息的订阅状态。itemSettings对象的键为**一次性订阅消息的模板id**或**系统订阅消息的类型**,值为'accept'、'reject'、'ban'中的其中一种。'accept'表示用户同意订阅这条消息,'reject'表示用户拒绝订阅这条消息,'ban'表示已被后台封禁。一次性订阅消息使用方法详见 [wx.requestSubscribeMessage](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html),永久订阅消息(仅小游戏可用)使用方法详见[wx.requestSubscribeSystemMessage](/minigame/dev/api/open-api/subscribe-message/wx.requestSubscribeSystemMessage.html) */ @@ -5233,6 +5463,25 @@ innerAudioContext.onError((res) => { tempImagePath: string errMsg: string } + /** 标签类型枚举 */ + interface TechType { + /** IsoDep 标签 */ + isoDep: string + /** MifareClassic 标签 */ + mifareClassic: string + /** MifareUltralight 标签 */ + mifareUltralight: string + /** Ndef 标签 */ + ndef: string + /** NfcA 标签 */ + nfcA: string + /** NfcB 标签 */ + nfcB: string + /** NfcF 标签 */ + nfcF: string + /** NfcV 标签 */ + nfcV: string + } interface TextMetrics { /** 文本的宽度 */ width: number @@ -5245,6 +5494,20 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: ToggleTorchSuccessCallback } + interface TransceiveOption { + /** 需要传递的二进制数据 */ + data: ArrayBuffer + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: TransceiveCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: TransceiveFailCallback + /** 接口调用成功的回调函数 */ + success?: TransceiveSuccessCallback + } + interface TransceiveSuccessCallbackResult { + data: ArrayBuffer + errMsg: string + } interface TranslateMarkerOption { /** 移动过程中是否自动旋转 marker */ autoRotate: boolean @@ -5374,6 +5637,20 @@ innerAudioContext.onError((res) => { /** 是否使用带 shareTicket 的转发[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */ withShareTicket?: boolean } + interface UpdateVoIPChatMuteConfigOption { + /** 静音设置 */ + muteConfig: MuteConfig + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: UpdateVoIPChatMuteConfigCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: UpdateVoIPChatMuteConfigFailCallback + /** 语音通话是否免提 + * + * 最低基础库: `2.10.4` */ + handsFree?: boolean + /** 接口调用成功的回调函数 */ + success?: UpdateVoIPChatMuteConfigSuccessCallback + } interface UploadFileOption { /** 要上传文件资源的路径 (本地路径) */ filePath: string @@ -5570,6 +5847,20 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: WriteFileSuccessCallback } + interface WriteNdefMessageOption { + /** 二进制对象数组, 需要指明 id, type 以及 payload (均为 ArrayBuffer 类型) */ + records: any[] + /** text 数组 */ + texts: any[] + /** uri 数组 */ + uris: any[] + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: WriteNdefMessageCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: WriteNdefMessageFailCallback + /** 接口调用成功的回调函数 */ + success?: WriteNdefMessageSuccessCallback + } interface WxGetFileInfoOption { /** 本地文件路径 (本地路径) */ filePath: string @@ -5897,18 +6188,18 @@ innerAudioContext.onError((res) => { ): void } interface BLEPeripheralServer { - /** [BLEPeripheralServer.addService(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.addService.html) + /** [BLEPeripheralServer.addService(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.addService.html) * * 添加服务。 * * 最低基础库: `2.10.3` */ addService(option: AddServiceOption): void - /** [BLEPeripheralServer.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.close.html) + /** [BLEPeripheralServer.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.close.html) * * 关闭当前服务端。 * * 最低基础库: `2.10.3` */ - close(option?: BLEPeripheralServerCloseOption): void + close(option?: NdefCloseOption): void /** [BLEPeripheralServer.offCharacteristicReadRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicReadRequest.html) * * 取消监听已连接的设备请求读当前外围设备的特征值事件 @@ -5945,25 +6236,25 @@ innerAudioContext.onError((res) => { /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */ callback: OnCharacteristicWriteRequestCallback ): void - /** [BLEPeripheralServer.removeService(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.removeService.html) + /** [BLEPeripheralServer.removeService(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.removeService.html) * * 移除服务。 * * 最低基础库: `2.10.3` */ removeService(option: RemoveServiceOption): void - /** [BLEPeripheralServer.startAdvertising(Object Object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.startAdvertising.html) + /** [BLEPeripheralServer.startAdvertising(Object Object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.startAdvertising.html) * * 开始广播本地创建的外围设备。 * * 最低基础库: `2.10.3` */ startAdvertising(Object: StartAdvertisingObject): void - /** [BLEPeripheralServer.stopAdvertising(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.stopAdvertising.html) + /** [BLEPeripheralServer.stopAdvertising(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.stopAdvertising.html) * * 停止广播。 * * 最低基础库: `2.10.3` */ stopAdvertising(option?: StopAdvertisingOption): void - /** [BLEPeripheralServer.writeCharacteristicValue(Object Object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/BLEPeripheralServer.writeCharacteristicValue.html) + /** [BLEPeripheralServer.writeCharacteristicValue(Object Object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html) * * 往指定特征值写入数据,并通知已连接的主机,从机的特征值已发生变化,该接口会处理是走回包还是走订阅。 * @@ -7803,7 +8094,7 @@ ctx.draw() * 最低基础库: `2.1.0` */ offProgressUpdate( /** 下载进度变化事件的回调函数 */ - callback: DownloadTaskOffProgressUpdateCallback + callback: OffProgressUpdateCallback ): void /** [DownloadTask.onHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onHeadersReceived.html) * @@ -8343,7 +8634,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offError( /** 音频播放错误事件的回调函数 */ - callback: InnerAudioContextOffErrorCallback + callback: OffErrorCallback ): void /** [InnerAudioContext.offPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offPause.html) * @@ -8510,7 +8801,7 @@ this.editorCtx.insertImage({ /** 选择器 */ targetSelector: string, /** 监听相交状态变化的回调函数 */ - callback: ObserveCallback + callback: IntersectionObserverObserveCallback ): void /** [[IntersectionObserver](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.html) IntersectionObserver.relativeTo(string selector, Object margins)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.relativeTo.html) * @@ -8560,14 +8851,14 @@ Page({ * 取消监听插屏广告关闭事件 */ offClose( /** 插屏广告关闭事件的回调函数 */ - callback: UDPSocketOffCloseCallback + callback: OffCloseCallback ): void /** [InterstitialAd.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offError.html) * * 取消监听插屏错误事件 */ offError( /** 插屏错误事件的回调函数 */ - callback: InterstitialAdOffErrorCallback + callback: OffErrorCallback ): void /** [InterstitialAd.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offLoad.html) * @@ -8639,6 +8930,68 @@ Page({ * | 2005 | 广告调用异常 | 插屏广告实例不允许跨页面调用 | */ show(): Promise } + interface IsoDep { + /** [IsoDep.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.close.html) + * + * 断开连接 + * + * 最低基础库: `2.11.2` */ + close(option?: NdefCloseOption): void + /** [IsoDep.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.connect.html) + * + * 连接 NFC 标签 + * + * 最低基础库: `2.11.2` */ + connect(option?: ConnectOption): void + /** [IsoDep.getHistoricalBytes(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.getHistoricalBytes.html) + * + * + * + * 最低基础库: `2.11.2` */ + getHistoricalBytes(option?: GetHistoricalBytesOption): void + /** [IsoDep.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.getMaxTransceiveLength.html) + * + * 获取最大传输长度 + * + * 最低基础库: `2.11.2` */ + getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void + /** [IsoDep.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.isConnected.html) + * + * 检查连接状态 + * + * 最低基础库: `2.11.2` */ + isConnected(option?: IsConnectedOption): void + /** [IsoDep.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.setTimeout.html) + * + * 设置超时时间 + * + * 最低基础库: `2.11.2` */ + setTimeout(option: SetTimeoutOption): void + /** [IsoDep.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.transceive.html) + * + * 发送数据 + * + * 最低基础库: `2.11.2` */ + transceive(option: TransceiveOption): void + } + interface JoinVoIPChatError { + /** 错误信息 + * + * | 错误码 | 错误信息 | 说明 | + * | - | - | - | + * | -1 | 当前已在房间内 | | + * | -2 | 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 | | + * | -3 | 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 | | + * | -1000 | 系统错误 | | */ errMsg: string + /** 错误码 + * + * | 错误码 | 错误信息 | 说明 | + * | - | - | - | + * | -1 | 当前已在房间内 | | + * | -2 | 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 | | + * | -3 | 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 | | + * | -1000 | 系统错误 | | */ errCode: number + } interface LivePlayerContext { /** [LivePlayerContext.exitFullScreen(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitFullScreen.html) * @@ -8903,6 +9256,21 @@ Page({ track: MediaTrack ): void } + interface MediaQueryObserver { + /** [MediaQueryObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/MediaQueryObserver.disconnect.html) + * + * 停止监听。回调函数将不再触发 */ + disconnect(): void + /** [MediaQueryObserver.observe(Object descriptor, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/MediaQueryObserver.observe.html) + * + * 开始监听页面 media query 变化情况 */ + observe( + /** media query 描述符 */ + descriptor: ObserveDescriptor, + /** 监听 media query 状态变化的回调函数 */ + callback: MediaQueryObserverObserveCallback + ): void + } interface MediaRecorder { /** [MediaRecorder.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.destroy.html) * @@ -8967,6 +9335,156 @@ Page({ * 最低基础库: `2.11.0` */ stop(): void } + interface MifareClassic { + /** [MifareClassic.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.close.html) + * + * 断开连接 + * + * 最低基础库: `2.11.2` */ + close(option?: NdefCloseOption): void + /** [MifareClassic.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.connect.html) + * + * 连接 NFC 标签 + * + * 最低基础库: `2.11.2` */ + connect(option?: ConnectOption): void + /** [MifareClassic.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.getMaxTransceiveLength.html) + * + * 获取最大传输长度 + * + * 最低基础库: `2.11.2` */ + getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void + /** [MifareClassic.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.isConnected.html) + * + * 检查连接状态 + * + * 最低基础库: `2.11.2` */ + isConnected(option?: IsConnectedOption): void + /** [MifareClassic.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.setTimeout.html) + * + * 设置超时时间 + * + * 最低基础库: `2.11.2` */ + setTimeout(option: SetTimeoutOption): void + /** [MifareClassic.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.transceive.html) + * + * 发送数据 + * + * 最低基础库: `2.11.2` */ + transceive(option: TransceiveOption): void + } + interface MifareUltralight { + /** [MifareUltralight.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.close.html) + * + * 断开连接 + * + * 最低基础库: `2.11.2` */ + close(option?: NdefCloseOption): void + /** [MifareUltralight.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.connect.html) + * + * 连接 NFC 标签 + * + * 最低基础库: `2.11.2` */ + connect(option?: ConnectOption): void + /** [MifareUltralight.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.getMaxTransceiveLength.html) + * + * 获取最大传输长度 + * + * 最低基础库: `2.11.2` */ + getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void + /** [MifareUltralight.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.isConnected.html) + * + * 检查连接状态 + * + * 最低基础库: `2.11.2` */ + isConnected(option?: IsConnectedOption): void + /** [MifareUltralight.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.setTimeout.html) + * + * 设置超时时间 + * + * 最低基础库: `2.11.2` */ + setTimeout(option: SetTimeoutOption): void + /** [MifareUltralight.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.transceive.html) + * + * 发送数据 + * + * 最低基础库: `2.11.2` */ + transceive(option: TransceiveOption): void + } + interface NFCAdapter { + /** [NFCAdapter.offDiscovered(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.offDiscovered.html) + * + * + * + * 最低基础库: `2.11.2` */ + offDiscovered(callback: (...args: any[]) => any): void + /** [NFCAdapter.onDiscovered(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.onDiscovered.html) + * + * + * + * 最低基础库: `2.11.2` */ + onDiscovered(callback: (...args: any[]) => any): void + /** [NFCAdapter.startDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.startDiscovery.html) + * + * + * + * 最低基础库: `2.11.2` */ + startDiscovery(option?: StartDiscoveryOption): void + /** [NFCAdapter.stopDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.stopDiscovery.html) + * + * + * + * 最低基础库: `2.11.2` */ + stopDiscovery(option?: StopDiscoveryOption): void + /** [[IsoDep](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.html) NFCAdapter.getIsoDep()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getIsoDep.html) + * + * + * + * 最低基础库: `2.11.2` */ + getIsoDep(): IsoDep + /** [[MifareClassic](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.html) NFCAdapter.getMifareClassic()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getMifareClassic.html) + * + * + * + * 最低基础库: `2.11.2` */ + getMifareClassic(): MifareClassic + /** [[MifareUltralight](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.html) NFCAdapter.getMifareUltralight()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getMifareUltralight.html) + * + * + * + * 最低基础库: `2.11.2` */ + getMifareUltralight(): MifareUltralight + /** [[Ndef](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.html) NFCAdapter.getNdef()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNdef.html) + * + * + * + * 最低基础库: `2.11.2` */ + getNdef(): Ndef + /** [[NfcA](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.html) NFCAdapter.getNfcA()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcA.html) + * + * + * + * 最低基础库: `2.11.2` */ + getNfcA(): NfcA + /** [[NfcB](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.html) NFCAdapter.getNfcB()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcB.html) + * + * + * + * 最低基础库: `2.11.2` */ + getNfcB(): NfcB + /** [[NfcF](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.html) NFCAdapter.getNfcF()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcF.html) + * + * + * + * 最低基础库: `2.11.2` */ + getNfcF(): NfcF + /** [[NfcV](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.html) NFCAdapter.getNfcV()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcV.html) + * + * + * + * 最低基础库: `2.11.2` */ + getNfcV(): NfcV + } interface NFCError { /** 错误信息 * @@ -8993,6 +9511,214 @@ Page({ * | 13005 | | 返回的指令不合法 | * | 13006 | | 注册AID失败 | */ errCode: number } + interface Ndef { + /** [Ndef.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.close.html) + * + * 断开连接 + * + * 最低基础库: `2.11.2` */ + close(option?: NdefCloseOption): void + /** [Ndef.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.connect.html) + * + * 连接 NFC 标签 + * + * 最低基础库: `2.11.2` */ + connect(option?: ConnectOption): void + /** [Ndef.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.isConnected.html) + * + * 检查连接状态 + * + * 最低基础库: `2.11.2` */ + isConnected(option?: IsConnectedOption): void + /** [Ndef.offNdefMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.offNdefMessage.html) + * + * 取消监听 Ndef 消息 + * + * 最低基础库: `2.11.2` */ + offNdefMessage(callback: (...args: any[]) => any): void + /** [Ndef.onNdefMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.onNdefMessage.html) + * + * 监听 Ndef 消息 + * + * 最低基础库: `2.11.2` */ + onNdefMessage(callback: (...args: any[]) => any): void + /** [Ndef.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.setTimeout.html) + * + * 设置超时时间 + * + * 最低基础库: `2.11.2` */ + setTimeout(option: SetTimeoutOption): void + /** [Ndef.writeNdefMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.writeNdefMessage.html) + * + * 重写 Ndef 标签内容 + * + * 最低基础库: `2.11.2` */ + writeNdefMessage(option: WriteNdefMessageOption): void + } + interface NfcA { + /** [NfcA.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.close.html) + * + * 断开连接 + * + * 最低基础库: `2.11.2` */ + close(option?: NdefCloseOption): void + /** [NfcA.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.connect.html) + * + * 连接 NFC 标签 + * + * 最低基础库: `2.11.2` */ + connect(option?: ConnectOption): void + /** [NfcA.getAtqa(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getAtqa.html) + * + * + * + * 最低基础库: `2.11.2` */ + getAtqa(option?: GetAtqaOption): void + /** [NfcA.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getMaxTransceiveLength.html) + * + * 获取最大传输长度 + * + * 最低基础库: `2.11.2` */ + getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void + /** [NfcA.getSak(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getSak.html) + * + * + * + * 最低基础库: `2.11.2` */ + getSak(option?: GetSakOption): void + /** [NfcA.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.isConnected.html) + * + * 检查连接状态 + * + * 最低基础库: `2.11.2` */ + isConnected(option?: IsConnectedOption): void + /** [NfcA.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.setTimeout.html) + * + * 设置超时时间 + * + * 最低基础库: `2.11.2` */ + setTimeout(option: SetTimeoutOption): void + /** [NfcA.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.transceive.html) + * + * 发送数据 + * + * 最低基础库: `2.11.2` */ + transceive(option: TransceiveOption): void + } + interface NfcB { + /** [NfcB.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.close.html) + * + * 断开连接 + * + * 最低基础库: `2.11.2` */ + close(option?: NdefCloseOption): void + /** [NfcB.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.connect.html) + * + * 连接 NFC 标签 + * + * 最低基础库: `2.11.2` */ + connect(option?: ConnectOption): void + /** [NfcB.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.getMaxTransceiveLength.html) + * + * 获取最大传输长度 + * + * 最低基础库: `2.11.2` */ + getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void + /** [NfcB.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.isConnected.html) + * + * 检查连接状态 + * + * 最低基础库: `2.11.2` */ + isConnected(option?: IsConnectedOption): void + /** [NfcB.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.setTimeout.html) + * + * 设置超时时间 + * + * 最低基础库: `2.11.2` */ + setTimeout(option: SetTimeoutOption): void + /** [NfcB.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.transceive.html) + * + * 发送数据 + * + * 最低基础库: `2.11.2` */ + transceive(option: TransceiveOption): void + } + interface NfcF { + /** [NfcF.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.close.html) + * + * 断开连接 + * + * 最低基础库: `2.11.2` */ + close(option?: NdefCloseOption): void + /** [NfcF.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.connect.html) + * + * 连接 NFC 标签 + * + * 最低基础库: `2.11.2` */ + connect(option?: ConnectOption): void + /** [NfcF.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.getMaxTransceiveLength.html) + * + * 获取最大传输长度 + * + * 最低基础库: `2.11.2` */ + getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void + /** [NfcF.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.isConnected.html) + * + * 检查连接状态 + * + * 最低基础库: `2.11.2` */ + isConnected(option?: IsConnectedOption): void + /** [NfcF.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.setTimeout.html) + * + * 设置超时时间 + * + * 最低基础库: `2.11.2` */ + setTimeout(option: SetTimeoutOption): void + /** [NfcF.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.transceive.html) + * + * 发送数据 + * + * 最低基础库: `2.11.2` */ + transceive(option: TransceiveOption): void + } + interface NfcV { + /** [NfcV.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.close.html) + * + * 断开连接 + * + * 最低基础库: `2.11.2` */ + close(option?: NdefCloseOption): void + /** [NfcV.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.connect.html) + * + * 连接 NFC 标签 + * + * 最低基础库: `2.11.2` */ + connect(option?: ConnectOption): void + /** [NfcV.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.getMaxTransceiveLength.html) + * + * 获取最大传输长度 + * + * 最低基础库: `2.11.2` */ + getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void + /** [NfcV.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.isConnected.html) + * + * 检查连接状态 + * + * 最低基础库: `2.11.2` */ + isConnected(option?: IsConnectedOption): void + /** [NfcV.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.setTimeout.html) + * + * 设置超时时间 + * + * 最低基础库: `2.11.2` */ + setTimeout(option: SetTimeoutOption): void + /** [NfcV.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.transceive.html) + * + * 发送数据 + * + * 最低基础库: `2.11.2` */ + transceive(option: TransceiveOption): void + } interface NodesRef { /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.boundingClientRect(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.boundingClientRect.html) * @@ -9404,14 +10130,14 @@ Page({ * 取消监听用户点击 `关闭广告` 按钮的事件 */ offClose( /** 用户点击 `关闭广告` 按钮的事件的回调函数 */ - callback: RewardedVideoAdOffCloseCallback + callback: OffCloseCallback ): void /** [RewardedVideoAd.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offError.html) * * 取消监听激励视频错误事件 */ offError( /** 激励视频错误事件的回调函数 */ - callback: RewardedVideoAdOffErrorCallback + callback: OffErrorCallback ): void /** [RewardedVideoAd.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offLoad.html) * @@ -9592,14 +10318,14 @@ Component({ * 取消监听关闭事件 */ offClose( /** 关闭事件的回调函数 */ - callback: UDPSocketOffCloseCallback + callback: OffCloseCallback ): void /** [UDPSocket.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offError.html) * * 取消监听错误事件 */ offError( /** 错误事件的回调函数 */ - callback: UDPSocketOffErrorCallback + callback: OffErrorCallback ): void /** [UDPSocket.offListening(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offListening.html) * @@ -9707,7 +10433,7 @@ Component({ * 最低基础库: `2.1.0` */ offProgressUpdate( /** 上传进度变化事件的回调函数 */ - callback: UploadTaskOffProgressUpdateCallback + callback: OffProgressUpdateCallback ): void /** [UploadTask.onHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onHeadersReceived.html) * @@ -9764,7 +10490,7 @@ Component({ ): void /** [VideoContext.requestFullScreen(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.requestFullScreen.html) * - * 进入全屏 + * 进入全屏。若有自定义内容需在全屏时展示,需将内容节点放置到 video 节点内。 * * 最低基础库: `1.4.0` */ requestFullScreen(option: VideoContextRequestFullScreenOption): void @@ -9801,7 +10527,7 @@ Component({ * 获取下一帧的解码数据 * * 最低基础库: `2.11.0` */ - getFrameData(): IAnyObject + getFrameData(): FrameDataOptions /** [VideoDecoder.off(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.off.html) * * 取消监听录制事件。当对应事件触发时,该回调函数不再执行 @@ -9824,8 +10550,10 @@ Component({ * 参数 eventName 可选值: * - 'start': 开始事件。返回 {width, height}; * - 'stop': 结束事件。; - * - 'seek': seek 完成事件。; */ - eventName: 'start' | 'stop' | 'seek', + * - 'seek': seek 完成事件。; + * - 'bufferchange': 缓冲区变化事件。; + * - 'ended': 解码结束事件。; */ + eventName: 'start' | 'stop' | 'seek' | 'bufferchange' | 'ended', /** 事件触发时执行的回调函数 */ callback: (...args: any[]) => any ): void @@ -10252,6 +10980,12 @@ logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3]) canvas: IAnyObject, options: CreateMediaRecorderOption ): MediaRecorder + /** [[NFCAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.html) wx.getNFCAdapter()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.getNFCAdapter.html) + * + * 获取 NFC 实例 + * + * 最低基础库: `2.11.2` */ + getNFCAdapter(): NFCAdapter /** [[OffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.html) wx.createOffscreenCanvas()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html) * * 创建离屏 canvas 实例 @@ -11045,6 +11779,14 @@ wx.createBLEConnection({ >( option?: TOption ): PromisifySuccessResult + /** [wx.exitVoIPChat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.exitVoIPChat.html) + * + * 退出(销毁)实时语音通话 + * + * 最低基础库: `2.7.0` */ + exitVoIPChat( + option?: TOption + ): PromisifySuccessResult /** [wx.getAvailableAudioSources(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.getAvailableAudioSources.html) * * 获取当前支持的音频输入源 @@ -11914,6 +12656,14 @@ wx.hideShareMenu() hideToast( option?: TOption ): PromisifySuccessResult + /** [wx.joinVoIPChat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.joinVoIPChat.html) + * + * 加入 (创建) 实时语音通话,更多信息可见 [实时语音指南](#) + * + * 最低基础库: `2.7.0` */ + joinVoIPChat( + option: TOption + ): PromisifySuccessResult /** [wx.loadFontFace(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/font/wx.loadFontFace.html) * * 动态加载网络字体,文件地址需为下载类型。[2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)起支持全局生效,需在 `app.js` 中调用。 @@ -12239,7 +12989,7 @@ wx.notifyBLECharacteristicValueChange({ /** 低功耗蓝牙连接状态的改变事件的回调函数 */ callback: (...args: any[]) => any ): void - /** [wx.offBLEPeripheralConnectionStateChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBLEPeripheralConnectionStateChanged.html) + /** [wx.offBLEPeripheralConnectionStateChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.offBLEPeripheralConnectionStateChanged.html) * * 取消监听当前外围设备被连接或断开连接事件 * @@ -12338,7 +13088,7 @@ wx.notifyBLECharacteristicValueChange({ /** 接收 NFC 设备消息事件的回调函数 */ callback: (...args: any[]) => any ): void - /** [wx.offKeyboardHeightChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/aapi/ui/keyboard/wx.offKeyboardHeightChange.html) + /** [wx.offKeyboardHeightChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/keyboard/wx.offKeyboardHeightChange.html) * * 取消监听键盘高度变化事件 * @@ -12410,6 +13160,15 @@ wx.notifyBLECharacteristicValueChange({ /** 网络状态变化事件的回调函数 */ callback: (...args: any[]) => any ): void + /** [wx.offOnVoIPVideoMembersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offOnVoIPVideoMembersChanged.html) + * + * 取消监听实时语音通话成员视频状态变化事件 + * + * 最低基础库: `2.11.0` */ + offOnVoIPVideoMembersChanged( + /** 实时语音通话成员视频状态变化事件的回调函数 */ + callback: OffOnVoIPVideoMembersChangedCallback + ): void /** [wx.offPageNotFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offPageNotFound.html) * * 取消监听小程序要打开的页面不存在事件 @@ -12446,6 +13205,24 @@ wx.notifyBLECharacteristicValueChange({ /** 用户主动截屏事件的回调函数 */ callback: (...args: any[]) => any ): void + /** [wx.offVoIPChatInterrupted(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatInterrupted.html) + * + * 取消监听被动断开实时语音通话事件。 + * + * 最低基础库: `2.9.0` */ + offVoIPChatInterrupted( + /** 被动断开实时语音通话事件的回调函数 */ + callback: (...args: any[]) => any + ): void + /** [wx.offVoIPChatMembersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatMembersChanged.html) + * + * 取消监听实时语音通话成员在线状态变化事件。 + * + * 最低基础库: `2.9.0` */ + offVoIPChatMembersChanged( + /** 实时语音通话成员在线状态变化事件的回调函数 */ + callback: (...args: any[]) => any + ): void /** [wx.offWifiConnected(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offWifiConnected.html) * * 取消监听连接上 Wi-Fi 的事件。 @@ -12582,7 +13359,7 @@ wx.onBLEConnectionStateChange(function(res) { /** 低功耗蓝牙连接状态的改变事件的回调函数 */ callback: OnBLEConnectionStateChangeCallback ): void - /** [wx.onBLEPeripheralConnectionStateChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBLEPeripheralConnectionStateChanged.html) + /** [wx.onBLEPeripheralConnectionStateChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.onBLEPeripheralConnectionStateChanged.html) * * 监听当前外围设备被连接或断开连接事件 * @@ -12879,6 +13656,15 @@ wx.onNetworkStatusChange(function (res) { /** 网络状态变化事件的回调函数 */ callback: OnNetworkStatusChangeCallback ): void + /** [wx.onOnVoIPVideoMembersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onOnVoIPVideoMembersChanged.html) + * + * 监听实时语音通话成员视频状态变化事件。 + * + * 最低基础库: `2.11.0` */ + onOnVoIPVideoMembersChanged( + /** 实时语音通话成员视频状态变化事件的回调函数 */ + callback: OnOnVoIPVideoMembersChangedCallback + ): void /** [wx.onPageNotFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onPageNotFound.html) * * 监听小程序要打开的页面不存在事件。该事件与 [`App.onPageNotFound`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onpagenotfoundobject-object) 的回调时机一致。 @@ -12970,6 +13756,33 @@ wx.onUserCaptureScreen(function (res) { /** 用户主动截屏事件的回调函数 */ callback: OnUserCaptureScreenCallback ): void + /** [wx.onVoIPChatInterrupted(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatInterrupted.html) + * + * 监听被动断开实时语音通话事件。包括小游戏切入后端时断开 + * + * 最低基础库: `2.7.0` */ + onVoIPChatInterrupted( + /** 被动断开实时语音通话事件的回调函数 */ + callback: OnVoIPChatInterruptedCallback + ): void + /** [wx.onVoIPChatMembersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatMembersChanged.html) + * + * 监听实时语音通话成员在线状态变化事件。有成员加入/退出通话时触发回调 + * + * 最低基础库: `2.7.0` */ + onVoIPChatMembersChanged( + /** 实时语音通话成员在线状态变化事件的回调函数 */ + callback: OnVoIPChatMembersChangedCallback + ): void + /** [wx.onVoIPChatSpeakersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatSpeakersChanged.html) + * + * 监听实时语音通话成员通话状态变化事件。有成员开始/停止说话时触发回调 + * + * 最低基础库: `2.7.0` */ + onVoIPChatSpeakersChanged( + /** 实时语音通话成员通话状态变化事件的回调函数 */ + callback: OnVoIPChatSpeakersChangedCallback + ): void /** [wx.onWifiConnected(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onWifiConnected.html) * * 监听连接上 Wi-Fi 的事件 @@ -12990,7 +13803,7 @@ wx.onUserCaptureScreen(function (res) { ): void /** [wx.openBluetoothAdapter(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html) * -* 初始化蓝牙模块。iOS 上开启主机/丛机模式时需分别调用一次,指定对应的 `mode`。 +* 初始化蓝牙模块。iOS 上开启主机/从机模式时需分别调用一次,指定对应的 `mode`。 * * **object.fail 回调函数返回的 state 参数(仅 iOS)** * @@ -13478,7 +14291,7 @@ wx.requestPayment({ * - 一次性模板 id 和永久模板 id 不可同时使用。 * - 低版本基础库2.4.4~2.8.3 已支持订阅消息接口调用,仅支持传入一个一次性 tmplId / 永久 tmplId。 * - [2.8.2](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为或者发起支付回调后,才可以调起订阅消息界面。 -* - [2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,开发版和体验版小程序将禁止使用模板消息 fomrId。 +* - [2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,开发版和体验版小程序将禁止使用模板消息 formId。 * * **错误码** * @@ -13659,7 +14472,7 @@ wx.startHCE({ * * ```js let socketOpen = false -const socketMsgQueue = [] +let socketMsgQueue = [] wx.connectSocket({ url: 'test.php' }) @@ -14651,6 +15464,16 @@ wx.stopWifi({ stopWifi( option?: TOption ): PromisifySuccessResult + /** [wx.subscribeVoIPVideoMembers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.subscribeVoIPVideoMembers.html) + * + * 订阅关系,调用后 `onVoIPVideoMembersChanged` 事件仅返回订阅成员的消息。 + * + * 最低基础库: `2.11.0` */ + subscribeVoIPVideoMembers< + TOption extends SubscribeVoIPVideoMembersOption + >( + option?: TOption + ): PromisifySuccessResult /** [wx.switchTab(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.switchTab.html) * * 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面 @@ -14698,6 +15521,16 @@ wx.updateShareMenu({ updateShareMenu( option: TOption ): PromisifySuccessResult + /** [wx.updateVoIPChatMuteConfig(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.updateVoIPChatMuteConfig.html) + * + * 更新实时语音静音设置 + * + * 最低基础库: `2.7.0` */ + updateVoIPChatMuteConfig< + TOption extends UpdateVoIPChatMuteConfigOption + >( + option: TOption + ): PromisifySuccessResult /** [wx.vibrateLong(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/vibrate/wx.vibrateLong.html) * * 使手机发生较长时间的振动(400 ms) @@ -15007,11 +15840,17 @@ wx.writeBLECharacteristicValue({ result: CompressVideoSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type ConnectCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type ConnectFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ConnectSocketCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type ConnectSocketFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type ConnectSocketSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type ConnectSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ConnectWifiCompleteCallback = (res: WifiError) => void /** 接口调用失败的回调函数 */ @@ -15053,10 +15892,6 @@ wx.writeBLECharacteristicValue({ result: DownloadFileSuccessCallbackResult ) => void /** 下载进度变化事件的回调函数 */ - type DownloadTaskOffProgressUpdateCallback = ( - result: DownloadTaskOnProgressUpdateCallbackResult - ) => void - /** 下载进度变化事件的回调函数 */ type DownloadTaskOnProgressUpdateCallback = ( result: DownloadTaskOnProgressUpdateCallbackResult ) => void @@ -15081,6 +15916,12 @@ wx.writeBLECharacteristicValue({ type ExitPictureInPictureSuccessCallback = ( res: GeneralCallbackResult ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type ExitVoIPChatCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type ExitVoIPChatFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type ExitVoIPChatSuccessCallback = (res: GeneralCallbackResult) => void /** 回调函数 */ type FieldsCallback = ( /** 节点的相关信息 */ @@ -15111,6 +15952,12 @@ wx.writeBLECharacteristicValue({ result: FileSystemManagerSaveFileSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type GetAtqaCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type GetAtqaFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type GetAtqaSuccessCallback = (result: GetAtqaSuccessCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetAvailableAudioSourcesCompleteCallback = ( res: GeneralCallbackResult ) => void @@ -15281,6 +16128,16 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type GetHCEStateSuccessCallback = (res: NFCError) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type GetHistoricalBytesCompleteCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用失败的回调函数 */ + type GetHistoricalBytesFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type GetHistoricalBytesSuccessCallback = ( + result: GetHistoricalBytesSuccessCallbackResult + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetImageInfoCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type GetImageInfoFailCallback = (res: GeneralCallbackResult) => void @@ -15297,6 +16154,18 @@ wx.writeBLECharacteristicValue({ result: GetLocationSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type GetMaxTransceiveLengthCompleteCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用失败的回调函数 */ + type GetMaxTransceiveLengthFailCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用成功的回调函数 */ + type GetMaxTransceiveLengthSuccessCallback = ( + result: GetMaxTransceiveLengthSuccessCallbackResult + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetNetworkTypeCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type GetNetworkTypeFailCallback = (res: GeneralCallbackResult) => void @@ -15321,6 +16190,12 @@ wx.writeBLECharacteristicValue({ result: GetRotateSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type GetSakCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type GetSakFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type GetSakSuccessCallback = (result: GetSakSuccessCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetSavedFileInfoCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type GetSavedFileInfoFailCallback = (res: GeneralCallbackResult) => void @@ -15505,10 +16380,6 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type IncludePointsSuccessCallback = (res: GeneralCallbackResult) => void /** 音频播放错误事件的回调函数 */ - type InnerAudioContextOffErrorCallback = ( - result: InnerAudioContextOnErrorCallbackResult - ) => void - /** 音频播放错误事件的回调函数 */ type InnerAudioContextOnErrorCallback = ( result: InnerAudioContextOnErrorCallbackResult ) => void @@ -15531,15 +16402,31 @@ wx.writeBLECharacteristicValue({ type InsertTextFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type InsertTextSuccessCallback = (res: GeneralCallbackResult) => void - /** 插屏错误事件的回调函数 */ - type InterstitialAdOffErrorCallback = ( - result: InterstitialAdOnErrorCallbackResult + /** 监听相交状态变化的回调函数 */ + type IntersectionObserverObserveCallback = ( + result: IntersectionObserverObserveCallbackResult ) => void /** 插屏错误事件的回调函数 */ type InterstitialAdOnErrorCallback = ( result: InterstitialAdOnErrorCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type IsConnectedCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type IsConnectedFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type IsConnectedSuccessCallback = ( + result: IsConnectedSuccessCallbackResult + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type JoinVoIPChatCompleteCallback = (res: JoinVoIPChatError) => void + /** 接口调用失败的回调函数 */ + type JoinVoIPChatFailCallback = (res: JoinVoIPChatError) => void + /** 接口调用成功的回调函数 */ + type JoinVoIPChatSuccessCallback = ( + result: JoinVoIPChatSuccessCallbackResult + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type LoadFontFaceCompleteCallback = ( result: LoadFontFaceCompleteCallbackResult ) => void @@ -15563,6 +16450,10 @@ wx.writeBLECharacteristicValue({ type MakePhoneCallFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type MakePhoneCallSuccessCallback = (res: GeneralCallbackResult) => void + /** 监听 media query 状态变化的回调函数 */ + type MediaQueryObserverObserveCallback = ( + result: MediaQueryObserverObserveCallbackResult + ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type MkdirCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ @@ -15633,12 +16524,10 @@ wx.writeBLECharacteristicValue({ type NotifyBLECharacteristicValueChangeSuccessCallback = ( res: BluetoothError ) => void - /** 监听相交状态变化的回调函数 */ - type ObserveCallback = (result: ObserveCallbackResult) => void /** 小程序切后台事件的回调函数 */ type OffAppHideCallback = (res: GeneralCallbackResult) => void /** 小程序切前台事件的回调函数 */ - type OffAppShowCallback = (result: OnAppShowCallbackResult) => void + type OffAppShowCallback = (res: GeneralCallbackResult) => void /** 音频因为受到系统占用而被中断开始事件的回调函数 */ type OffAudioInterruptionBeginCallback = ( res: GeneralCallbackResult @@ -15647,7 +16536,7 @@ wx.writeBLECharacteristicValue({ type OffAudioInterruptionEndCallback = (res: GeneralCallbackResult) => void /** 当前外围设备被连接或断开连接事件的回调函数 */ type OffBLEPeripheralConnectionStateChangedCallback = ( - result: OnBLEPeripheralConnectionStateChangedCallbackResult + res: GeneralCallbackResult ) => void /** iBeacon 服务状态变化事件的回调函数 */ type OffBeaconServiceChangeCallback = (res: GeneralCallbackResult) => void @@ -15657,18 +16546,18 @@ wx.writeBLECharacteristicValue({ type OffCanplayCallback = (res: GeneralCallbackResult) => void /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ type OffCharacteristicReadRequestCallback = ( - result: OnCharacteristicReadRequestCallbackResult + res: GeneralCallbackResult ) => void /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */ type OffCharacteristicWriteRequestCallback = ( - result: OnCharacteristicWriteRequestCallbackResult + res: GeneralCallbackResult ) => void + type OffCloseCallback = (res: GeneralCallbackResult) => void /** 音频自然播放至结束的事件的回调函数 */ type OffEndedCallback = (res: GeneralCallbackResult) => void + type OffErrorCallback = (res: GeneralCallbackResult) => void /** HTTP Response Header 事件的回调函数 */ - type OffHeadersReceivedCallback = ( - result: OnHeadersReceivedCallbackResult - ) => void + type OffHeadersReceivedCallback = (res: GeneralCallbackResult) => void /** 开始监听数据包消息的事件的回调函数 */ type OffListeningCallback = (res: GeneralCallbackResult) => void type OffLoadCallback = (res: GeneralCallbackResult) => void @@ -15677,31 +16566,28 @@ wx.writeBLECharacteristicValue({ res: GeneralCallbackResult ) => void /** mDNS 服务发现的事件的回调函数 */ - type OffLocalServiceFoundCallback = ( - result: OnLocalServiceFoundCallbackResult - ) => void + type OffLocalServiceFoundCallback = (res: GeneralCallbackResult) => void /** mDNS 服务离开的事件的回调函数 */ - type OffLocalServiceLostCallback = ( - result: OnLocalServiceLostCallbackResult - ) => void + type OffLocalServiceLostCallback = (res: GeneralCallbackResult) => void /** mDNS 服务解析失败的事件的回调函数 */ type OffLocalServiceResolveFailCallback = ( - result: OnLocalServiceLostCallbackResult + res: GeneralCallbackResult ) => void /** 实时地理位置变化事件的回调函数 */ - type OffLocationChangeCallback = ( - result: OnLocationChangeCallbackResult - ) => void + type OffLocationChangeCallback = (res: GeneralCallbackResult) => void /** 收到消息的事件的回调函数 */ - type OffMessageCallback = (result: UDPSocketOnMessageCallbackResult) => void - /** 小程序要打开的页面不存在事件的回调函数 */ - type OffPageNotFoundCallback = ( - result: OnPageNotFoundCallbackResult + type OffMessageCallback = (res: GeneralCallbackResult) => void + /** 实时语音通话成员视频状态变化事件的回调函数 */ + type OffOnVoIPVideoMembersChangedCallback = ( + res: GeneralCallbackResult ) => void + /** 小程序要打开的页面不存在事件的回调函数 */ + type OffPageNotFoundCallback = (res: GeneralCallbackResult) => void /** 音频暂停事件的回调函数 */ type OffPauseCallback = (res: GeneralCallbackResult) => void /** 音频播放事件的回调函数 */ type OffPlayCallback = (res: GeneralCallbackResult) => void + type OffProgressUpdateCallback = (res: GeneralCallbackResult) => void /** 音频完成跳转操作的事件的回调函数 */ type OffSeekedCallback = (res: GeneralCallbackResult) => void /** 音频进行跳转操作的事件的回调函数 */ @@ -15709,19 +16595,15 @@ wx.writeBLECharacteristicValue({ /** 音频停止事件的回调函数 */ type OffStopCallback = (res: GeneralCallbackResult) => void /** 系统主题改变事件的回调函数 */ - type OffThemeChangeCallback = (result: OnThemeChangeCallbackResult) => void + type OffThemeChangeCallback = (res: GeneralCallbackResult) => void /** 音频播放进度更新事件的回调函数 */ type OffTimeUpdateCallback = (res: GeneralCallbackResult) => void /** 未处理的 Promise 拒绝事件的回调函数 */ - type OffUnhandledRejectionCallback = ( - result: OnUnhandledRejectionCallbackResult - ) => void + type OffUnhandledRejectionCallback = (res: GeneralCallbackResult) => void /** 音频加载中事件的回调函数 */ type OffWaitingCallback = (res: GeneralCallbackResult) => void /** 窗口尺寸变化事件的回调函数 */ - type OffWindowResizeCallback = ( - result: OnWindowResizeCallbackResult - ) => void + type OffWindowResizeCallback = (res: GeneralCallbackResult) => void /** 加速度数据事件的回调函数 */ type OnAccelerometerChangeCallback = ( result: OnAccelerometerChangeCallbackResult @@ -15863,6 +16745,10 @@ wx.writeBLECharacteristicValue({ ) => void /** 用户在系统音乐播放面板点击下一曲事件的回调函数 */ type OnNextCallback = (res: GeneralCallbackResult) => void + /** 实时语音通话成员视频状态变化事件的回调函数 */ + type OnOnVoIPVideoMembersChangedCallback = ( + result: OnOnVoIPVideoMembersChangedCallbackResult + ) => void /** WebSocket 连接打开事件的回调函数 */ type OnOpenCallback = (result: OnOpenCallbackResult) => void /** 小程序要打开的页面不存在事件的回调函数 */ @@ -15904,6 +16790,18 @@ wx.writeBLECharacteristicValue({ type OnUpdateReadyCallback = (res: GeneralCallbackResult) => void /** 用户主动截屏事件的回调函数 */ type OnUserCaptureScreenCallback = (res: GeneralCallbackResult) => void + /** 被动断开实时语音通话事件的回调函数 */ + type OnVoIPChatInterruptedCallback = ( + result: OnVoIPChatInterruptedCallbackResult + ) => void + /** 实时语音通话成员在线状态变化事件的回调函数 */ + type OnVoIPChatMembersChangedCallback = ( + result: OnVoIPChatMembersChangedCallbackResult + ) => void + /** 实时语音通话成员通话状态变化事件的回调函数 */ + type OnVoIPChatSpeakersChangedCallback = ( + result: OnVoIPChatSpeakersChangedCallbackResult + ) => void /** 音频加载中事件的回调函数 */ type OnWaitingCallback = (res: GeneralCallbackResult) => void /** 连接上 Wi-Fi 的事件的回调函数 */ @@ -16137,14 +17035,6 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type ResumeSuccessCallback = (res: GeneralCallbackResult) => void /** 用户点击 `关闭广告` 按钮的事件的回调函数 */ - type RewardedVideoAdOffCloseCallback = ( - result: RewardedVideoAdOnCloseCallbackResult - ) => void - /** 激励视频错误事件的回调函数 */ - type RewardedVideoAdOffErrorCallback = ( - result: RewardedVideoAdOnErrorCallbackResult - ) => void - /** 用户点击 `关闭广告` 按钮的事件的回调函数 */ type RewardedVideoAdOnCloseCallback = ( result: RewardedVideoAdOnCloseCallbackResult ) => void @@ -16381,6 +17271,12 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type SetTabBarStyleSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type SetTimeoutCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type SetTimeoutFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type SetTimeoutSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SetTopBarTextCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type SetTopBarTextFailCallback = (res: GeneralCallbackResult) => void @@ -16524,6 +17420,12 @@ wx.writeBLECharacteristicValue({ type StartDeviceMotionListeningSuccessCallback = ( res: GeneralCallbackResult ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type StartDiscoveryCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type StartDiscoveryFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type StartDiscoverySuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type StartFailCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ @@ -16690,6 +17592,12 @@ wx.writeBLECharacteristicValue({ type StopDeviceMotionListeningSuccessCallback = ( res: GeneralCallbackResult ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type StopDiscoveryCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type StopDiscoveryFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type StopDiscoverySuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type StopFailCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ @@ -16761,6 +17669,18 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type StopWifiSuccessCallback = (res: WifiError) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type SubscribeVoIPVideoMembersCompleteCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用失败的回调函数 */ + type SubscribeVoIPVideoMembersFailCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用成功的回调函数 */ + type SubscribeVoIPVideoMembersSuccessCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SwitchCameraCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type SwitchCameraFailCallback = (res: GeneralCallbackResult) => void @@ -16787,16 +17707,19 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type ToggleTorchSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type TransceiveCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type TransceiveFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type TransceiveSuccessCallback = ( + result: TransceiveSuccessCallbackResult + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type TranslateMarkerCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type TranslateMarkerFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type TranslateMarkerSuccessCallback = (res: GeneralCallbackResult) => void - type UDPSocketOffCloseCallback = (res: GeneralCallbackResult) => void - /** 错误事件的回调函数 */ - type UDPSocketOffErrorCallback = ( - result: UDPSocketOnErrorCallbackResult - ) => void type UDPSocketOnCloseCallback = (res: GeneralCallbackResult) => void type UDPSocketOnErrorCallback = ( result: UDPSocketOnErrorCallbackResult @@ -16830,6 +17753,18 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type UpdateShareMenuSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type UpdateVoIPChatMuteConfigCompleteCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用失败的回调函数 */ + type UpdateVoIPChatMuteConfigFailCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用成功的回调函数 */ + type UpdateVoIPChatMuteConfigSuccessCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type UploadFileCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type UploadFileFailCallback = (res: GeneralCallbackResult) => void @@ -16838,10 +17773,6 @@ wx.writeBLECharacteristicValue({ result: UploadFileSuccessCallbackResult ) => void /** 上传进度变化事件的回调函数 */ - type UploadTaskOffProgressUpdateCallback = ( - result: UploadTaskOnProgressUpdateCallbackResult - ) => void - /** 上传进度变化事件的回调函数 */ type UploadTaskOnProgressUpdateCallback = ( result: UploadTaskOnProgressUpdateCallbackResult ) => void @@ -16877,6 +17808,12 @@ wx.writeBLECharacteristicValue({ type WriteFileFailCallback = (result: WriteFileFailCallbackResult) => void /** 接口调用成功的回调函数 */ type WriteFileSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type WriteNdefMessageCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type WriteNdefMessageFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type WriteNdefMessageSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type WxGetFileInfoFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ diff --git a/types/wx/lib.wx.cloud.d.ts b/types/wx/lib.wx.cloud.d.ts index 12b6395..e8dcd13 100644 --- a/types/wx/lib.wx.cloud.d.ts +++ b/types/wx/lib.wx.cloud.d.ts @@ -20,14 +20,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ***************************************************************************** */ -///////////////////// -///// WX Cloud Apis -///////////////////// - -/** - * Common interfaces and types - */ - interface IAPIError { errMsg: string } @@ -126,6 +118,9 @@ interface WxCloud { ): Promise database: (config?: ICloudConfig) => DB.Database + + CloudID: ICloud.ICloudIDConstructor + CDN: ICloud.ICDNConstructor } declare namespace ICloud { @@ -205,6 +200,34 @@ declare namespace ICloud { fileList: string[] } // === end === + + // === API: CloudID === + abstract class CloudID { + constructor(cloudID: string) + } + + interface ICloudIDConstructor { + new (cloudId: string): CloudID + (cloudId: string): CloudID + } + // === end === + + // === API: CDN === + abstract class CDN { + target: string | ArrayBuffer | ICDNFilePathSpec + constructor(target: string | ArrayBuffer | ICDNFilePathSpec) + } + + interface ICDNFilePathSpec { + type: 'filePath' + filePath: string + } + + interface ICDNConstructor { + new (options: string | ArrayBuffer | ICDNFilePathSpec): CDN + (options: string | ArrayBuffer | ICDNFilePathSpec): CDN + } + // === end === } // === Database === diff --git a/types/wx/lib.wx.page.d.ts b/types/wx/lib.wx.page.d.ts index 396cbf4..40ecd8b 100644 --- a/types/wx/lib.wx.page.d.ts +++ b/types/wx/lib.wx.page.d.ts @@ -99,7 +99,7 @@ declare namespace WechatMiniprogram { onShareAppMessage( /** 分享发起来源参数 */ options: IShareAppMessageOption - ): ICustomShareContent + ): ICustomShareContent | void /** 页面滚动触发事件的处理函数 * * 监听用户滑动页面事件。 From 1ee86dc69e14a05a4e83282d57d1d1cda18d5992 Mon Sep 17 00:00:00 2001 From: wechat-miniprogram-admin Date: Wed, 15 Jul 2020 19:30:25 +0800 Subject: [PATCH 020/205] 2.11.2-beta --- VERSIONS.md | 3 ++- package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/VERSIONS.md b/VERSIONS.md index 0417172..2a58fd9 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -2,6 +2,7 @@ 基础库版本|npm 版本|命令 -|-|- +[v2.11.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-11-2-2020-06-08) | [2.11.2-beta](https://www.npmjs.com/package/miniprogram-api-typings/v/2.11.2-beta) | `npm install miniprogram-api-typings@2.11.0-1` [v2.11.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-11-0-2020-04-24) | [2.11.0-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.11.0-1) | `npm install miniprogram-api-typings@2.11.0-1` [v2.10.4](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-4-2020-03-24) | [2.10.4](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.4) | `npm install miniprogram-api-typings@2.10.4` [v2.10.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-3-2020-03-06) | [2.10.3-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.3-1) | `npm install miniprogram-api-typings@2.10.3-1` @@ -21,4 +22,4 @@ [v2.6.5](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-6-5-2019-04-02) | [2.6.5-2](https://www.npmjs.com/package/miniprogram-api-typings/v/2.6.5-2) | `npm install miniprogram-api-typings@2.6.5-2` [v2.4.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/v2.html#v2-4-2-2018-12-04)|[2.4.2-2](https://www.npmjs.com/package/miniprogram-api-typings/v/2.4.2-2)|`npm install miniprogram-api-typings@2.4.2-2` [v2.4.1](https://developers.weixin.qq.com/miniprogram/dev/framework/release/v2.html#v2-4-1-2018-11-21)|[2.4.1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.4.1)|`npm install miniprogram-api-typings@2.4.1` -[v2.4.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/v2.html#v2-4-0-2018-11-05)|[2.4.0-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.4.0-1)|`npm install miniprogram-api-typings@2. \ No newline at end of file +[v2.4.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/v2.html#v2-4-0-2018-11-05)|[2.4.0-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.4.0-1)|`npm install miniprogram-api-typings@2.4.0.1` \ No newline at end of file diff --git a/package.json b/package.json index 1712e58..17e2acf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.11.0-1", + "version": "2.11.2-beta", "description": "Type definitions for APIs of Wechat Mini Program in TypeScript", "main": "./index.d.ts", "types": "./index.d.ts", From 33cf08f3b6c3ed52ca7e9d206f16945a2c6f10e4 Mon Sep 17 00:00:00 2001 From: wechat-miniprogram-admin Date: Wed, 15 Jul 2020 19:49:27 +0800 Subject: [PATCH 021/205] 2.11.2-beta --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 17e2acf..c39db04 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "miniprogram-api-typings", "version": "2.11.2-beta", + "beta": "true", "description": "Type definitions for APIs of Wechat Mini Program in TypeScript", "main": "./index.d.ts", "types": "./index.d.ts", From a00b89c4dc82a620fd77ee35a04215eb3b815a3d Mon Sep 17 00:00:00 2001 From: wechat-miniprogram-admin Date: Fri, 17 Jul 2020 12:34:43 +0800 Subject: [PATCH 022/205] 2.11.3-beta --- VERSIONS.md | 3 ++- package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/VERSIONS.md b/VERSIONS.md index 2a58fd9..e8adfd6 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -2,7 +2,8 @@ 基础库版本|npm 版本|命令 -|-|- -[v2.11.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-11-2-2020-06-08) | [2.11.2-beta](https://www.npmjs.com/package/miniprogram-api-typings/v/2.11.2-beta) | `npm install miniprogram-api-typings@2.11.0-1` +[v2.11.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-11-2-2020-06-08) | [2.11.3-beta](https://www.npmjs.com/package/miniprogram-api-typings/v/2.11.3-beta) | `npm install miniprogram-api-typings@2.11.3-beta` +[v2.11.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-11-2-2020-06-08) | [2.11.2-beta](https://www.npmjs.com/package/miniprogram-api-typings/v/2.11.2-beta) | `npm install miniprogram-api-typings@2.11.2-beta` [v2.11.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-11-0-2020-04-24) | [2.11.0-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.11.0-1) | `npm install miniprogram-api-typings@2.11.0-1` [v2.10.4](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-4-2020-03-24) | [2.10.4](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.4) | `npm install miniprogram-api-typings@2.10.4` [v2.10.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-3-2020-03-06) | [2.10.3-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.3-1) | `npm install miniprogram-api-typings@2.10.3-1` diff --git a/package.json b/package.json index c39db04..5f57f1a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.11.2-beta", + "version": "2.11.3-beta", "beta": "true", "description": "Type definitions for APIs of Wechat Mini Program in TypeScript", "main": "./index.d.ts", From 41cfcde728ea27996f971a8c079bfae0fa298f3c Mon Sep 17 00:00:00 2001 From: wechat-miniprogram-admin Date: Fri, 24 Jul 2020 16:15:06 +0800 Subject: [PATCH 023/205] 2.11.3-beta --- types/wx/lib.wx.api.d.ts | 691 ++++++++++++++++++++++----------------- 1 file changed, 388 insertions(+), 303 deletions(-) diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index c24f915..e0a25bf 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -78,6 +78,16 @@ declare namespace WechatMiniprogram { cardList: AddCardResponseInfo[] errMsg: string } + interface AddCustomLayerOption { + /** 个性化图层id */ + layerId: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AddCustomLayerCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: AddCustomLayerFailCallback + /** 接口调用成功的回调函数 */ + success?: AddCustomLayerSuccessCallback + } interface AddPhoneContactOption { /** 名字 */ firstName: string @@ -1263,6 +1273,10 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb complete?: ConnectWifiCompleteCallback /** 接口调用失败的回调函数 */ fail?: ConnectWifiFailCallback + /** 跳转到系统设置页进行连接,仅安卓生效 + * + * 最低基础库: `2.12.0` */ + maunal?: boolean /** 接口调用成功的回调函数 */ success?: ConnectWifiSuccessCallback } @@ -1343,14 +1357,6 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 视频比特率(kbps),最小值 600,最大值 3000 */ videoBitsPerSecond?: number } - interface CreateRewardedVideoAdOption { - /** 广告单元 id */ - adUnitId: string - /** 是否启用多例模式,默认为false - * - * 最低基础库: `2.8.0` */ - multiton?: boolean - } /** 弹幕内容 */ interface Danmu { /** 弹幕文字 */ @@ -1381,6 +1387,14 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 经度 */ longitude: number } + interface DisableAlertBeforeUnloadOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: DisableAlertBeforeUnloadCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: DisableAlertBeforeUnloadFailCallback + /** 接口调用成功的回调函数 */ + success?: DisableAlertBeforeUnloadSuccessCallback + } interface DownloadFileOption { /** 下载资源的 url */ url: string @@ -1475,6 +1489,16 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 已经下载的数据长度,单位 Bytes */ totalBytesWritten: number } + interface EnableAlertBeforeUnloadOption { + /** 询问对话框内容 */ + message: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: EnableAlertBeforeUnloadCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: EnableAlertBeforeUnloadFailCallback + /** 接口调用成功的回调函数 */ + success?: EnableAlertBeforeUnloadSuccessCallback + } interface ExitFullScreenOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: ExitFullScreenCompleteCallback @@ -1594,7 +1618,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb savedFilePath: string errMsg: string } - /** 视频帧数据,若取不到则返回 null。当缓存区满的时候可能暂停取不到数据。 */ + /** 视频帧数据,若取不到则返回 null。当缓冲区为空的时候可能暂停取不到数据。 */ interface FrameDataOptions { /** 帧数据 */ data: ArrayBuffer @@ -2623,6 +2647,10 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb complete?: HideShareMenuCompleteCallback /** 接口调用失败的回调函数 */ fail?: HideShareMenuFailCallback + /** 本接口为 Beta 版本,暂只在 Android 平台支持。需要隐藏的转发按钮名称列表,默认['shareAppMessage', 'shareTimeline']。按钮名称合法值包含 "shareAppMessage"、"shareTimeline" 两种 + * + * 最低基础库: `2.11.3` */ + menus?: string[] /** 接口调用成功的回调函数 */ success?: HideShareMenuSuccessCallback } @@ -2872,19 +2900,6 @@ innerAudioContext.onError((res) => { /** 错误信息 */ errMsg: string } - interface IsConnectedOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: IsConnectedCompleteCallback - /** 接口调用失败的回调函数 */ - fail?: IsConnectedFailCallback - /** 接口调用成功的回调函数 */ - success?: IsConnectedSuccessCallback - } - interface IsConnectedSuccessCallbackResult { - /** 是否连接 */ - connected: boolean - errMsg: string - } interface JoinVoIPChatOption { /** 小游戏内此房间/群聊的 ID。同一时刻传入相同 groupId 的用户会进入到同个实时语音房间。 */ groupId: string @@ -2898,12 +2913,14 @@ innerAudioContext.onError((res) => { complete?: JoinVoIPChatCompleteCallback /** 接口调用失败的回调函数 */ fail?: JoinVoIPChatFailCallback - /** 语音通话是否免提 - * - * 最低基础库: `2.10.4` */ - handsFree?: boolean /** 静音设置 */ muteConfig?: MuteConfig + /** 房间类型 + * + * 可选值: + * - 'voice': 音频房间,用于语音通话; + * - 'video': 视频房间,结合 [voip-room](https://developers.weixin.qq.com/miniprogram/dev/component/voip-room.html) 组件可显示成员画面; */ + roomType?: 'voice' | 'video' /** 接口调用成功的回调函数 */ success?: JoinVoIPChatSuccessCallback } @@ -2982,6 +2999,20 @@ innerAudioContext.onError((res) => { code: string errMsg: string } + interface MakeBluetoothPairOption { + /** 蓝牙设备 id */ + deviceId: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: MakeBluetoothPairCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: MakeBluetoothPairFailCallback + /** pin 码 */ + pin?: ArrayBuffer + /** 接口调用成功的回调函数 */ + success?: MakeBluetoothPairSuccessCallback + /** 超时时间 */ + timeout?: number + } interface MakePhoneCallOption { /** 需要拨打的电话号码 */ phoneNumber: string @@ -3035,6 +3066,19 @@ innerAudioContext.onError((res) => { /** 页面的当前状态是否满足所指定的 media query */ matches: boolean } + /** 需要预览的资源列表 */ + interface MediaSource { + /** 图片或视频的地址 */ + url: string + /** 视频的封面图片 */ + poster?: string + /** 资源的类型,默认为图片 + * + * 可选值: + * - 'image': 图片; + * - 'video': 视频; */ + type?: 'image' | 'video' + } /** 可通过 [MediaContainer.extractDataSource](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.extractDataSource.html) 返回。 * * [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) 音频或视频轨道,可以对轨道进行一些操作 @@ -3280,13 +3324,13 @@ innerAudioContext.onError((res) => { /** server 的 uuid */ serverId: string } - interface OnBackgroundFetchDataOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: OnBackgroundFetchDataCompleteCallback - /** 接口调用失败的回调函数 */ - fail?: OnBackgroundFetchDataFailCallback - /** 接口调用成功的回调函数 */ - success?: OnBackgroundFetchDataSuccessCallback + interface OnBackgroundFetchDataCallbackResult { + /** 缓存数据类别 (periodic) */ + fetchType: string + /** 缓存数据 */ + fetchedData: string + /** 客户端拿到缓存数据的时间戳 */ + timeStamp: number } interface OnBeaconServiceChangeCallbackResult { /** 服务目前是否可用 */ @@ -3338,6 +3382,12 @@ innerAudioContext.onError((res) => { /** 是否有新版本 */ hasUpdate: boolean } + interface OnCloseCallbackResult { + /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ + code: number + /** 一个可读的字符串,表示连接被关闭的原因。 */ + reason: string + } interface OnCompassChangeCallbackResult { /** 精度 * @@ -3354,6 +3404,12 @@ innerAudioContext.onError((res) => { /** 当手机 X/Z 和地球 X/Z 重合时,绕着 Y 轴转动的夹角为 gamma。范围值为 [-1*PI/2, PI/2)。右边朝着地球表面转动为正。 */ gamma: number } + interface OnDiscoveredCallbackResult { + /** NdefMessage 数组 */ + messages: any[] + /** tech 数组,用于匹配NFC卡片具体可以使用什么标准(NfcA等实例)处理 */ + techs: any[] + } interface OnFrameRecordedCallbackResult { /** 录音分片数据 */ frameBuffer: ArrayBuffer @@ -3458,7 +3514,7 @@ innerAudioContext.onError((res) => { errCode: number /** 调用结果 */ errMsg: string - /** 开启视频的成员 openId 名单 */ + /** 开启视频的成员名单 */ openIdList: string[] } interface OnOpenCallbackResult { @@ -3643,6 +3699,27 @@ innerAudioContext.onError((res) => { subscriptionsSetting: SubscriptionsSetting errMsg: string } + interface OpenVideoEditorOption { + /** 视频源的路径,只支持本地路径 */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: OpenVideoEditorCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: OpenVideoEditorFailCallback + /** 接口调用成功的回调函数 */ + success?: OpenVideoEditorSuccessCallback + } + interface OpenVideoEditorSuccessCallbackResult { + /** 剪辑后生成的视频文件的时长,单位毫秒(ms) */ + duration: number + /** 剪辑后生成的视频文件大小,单位字节数(byte) */ + size: number + /** 编辑后生成的视频文件的临时路径 */ + tempFilePath: string + /** 编辑后生成的缩略图文件的临时路径 */ + tempThumbPath: string + errMsg: string + } interface PageScrollToOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: PageScrollToCompleteCallback @@ -3767,6 +3844,18 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: PreviewImageSuccessCallback } + interface PreviewMediaOption { + /** 需要预览的资源列表 */ + sources: MediaSource[] + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PreviewMediaCompleteCallback + /** 当前显示的资源序号 */ + current?: current + /** 接口调用失败的回调函数 */ + fail?: PreviewMediaFailCallback + /** 接口调用成功的回调函数 */ + success?: PreviewMediaSuccessCallback + } interface ReLaunchOption { /** 需要跳转的应用内页面路径 (代码包路径),路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2' */ url: string @@ -3998,6 +4087,16 @@ innerAudioContext.onError((res) => { /** message 的大小,单位:字节 */ size: number } + interface RemoveCustomLayerOption { + /** 个性化图层id */ + layerId: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RemoveCustomLayerCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: RemoveCustomLayerFailCallback + /** 接口调用成功的回调函数 */ + success?: RemoveCustomLayerSuccessCallback + } interface RemoveFormatOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: RemoveFormatCompleteCallback @@ -4276,31 +4375,6 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: ResumeSuccessCallback } - interface RewardedVideoAdOnCloseCallbackResult { - /** 视频是否是在用户完整观看的情况下被关闭的 - * - * 最低基础库: `2.1.0` */ - isEnded: boolean - } - interface RewardedVideoAdOnErrorCallbackResult { - /** 错误码 - * - * 可选值: - * - 1000: 后端接口调用失败; - * - 1001: 参数错误; - * - 1002: 广告单元无效; - * - 1003: 内部错误; - * - 1004: 无合适的广告; - * - 1005: 广告组件审核中; - * - 1006: 广告组件被驳回; - * - 1007: 广告组件被封禁; - * - 1008: 广告单元已关闭; - * - * 最低基础库: `2.2.2` */ - errCode: 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 - /** 错误信息 */ - errMsg: string - } interface RmdirFailCallbackResult { /** 错误信息 * @@ -4861,6 +4935,10 @@ innerAudioContext.onError((res) => { complete?: ShowShareMenuCompleteCallback /** 接口调用失败的回调函数 */ fail?: ShowShareMenuFailCallback + /** 本接口为 Beta 版本,暂只在 Android 平台支持。需要显示的转发按钮名称列表,默认['shareAppMessage']。按钮名称合法值包含 "shareAppMessage"、"shareTimeline" 两种 + * + * 最低基础库: `2.11.3` */ + menus?: string[] /** 接口调用成功的回调函数 */ success?: ShowShareMenuSuccessCallback /** 是否使用带 shareTicket 的转发[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */ @@ -4950,12 +5028,6 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: CloseSuccessCallback } - interface SocketTaskOnCloseCallbackResult { - /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ - code: number - /** 一个可读的字符串,表示连接被关闭的原因。 */ - reason: string - } interface SocketTaskOnMessageCallbackResult { /** 服务器返回的消息 */ data: string | ArrayBuffer @@ -5410,14 +5482,6 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: StopWifiSuccessCallback } - interface SubscribeVoIPVideoMembersOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: SubscribeVoIPVideoMembersCompleteCallback - /** 接口调用失败的回调函数 */ - fail?: SubscribeVoIPVideoMembersFailCallback - /** 接口调用成功的回调函数 */ - success?: SubscribeVoIPVideoMembersSuccessCallback - } /** 订阅消息设置 */ interface SubscriptionsSetting { /** 每一项订阅消息的订阅状态。itemSettings对象的键为**一次性订阅消息的模板id**或**系统订阅消息的类型**,值为'accept'、'reject'、'ban'中的其中一种。'accept'表示用户同意订阅这条消息,'reject'表示用户拒绝订阅这条消息,'ban'表示已被后台封禁。一次性订阅消息使用方法详见 [wx.requestSubscribeMessage](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html),永久订阅消息(仅小游戏可用)使用方法详见[wx.requestSubscribeSystemMessage](/minigame/dev/api/open-api/subscribe-message/wx.requestSubscribeSystemMessage.html) */ @@ -5465,21 +5529,21 @@ innerAudioContext.onError((res) => { } /** 标签类型枚举 */ interface TechType { - /** IsoDep 标签 */ + /** 对应IsoDep实例,实例支持ISO-DEP (ISO 14443-4)标准的读写 */ isoDep: string - /** MifareClassic 标签 */ + /** 对应MifareClassic实例,实例支持MIFARE Classic标签的读写 */ mifareClassic: string - /** MifareUltralight 标签 */ + /** 对应MifareUltralight实例,实例支持MIFARE Ultralight标签的读写 */ mifareUltralight: string - /** Ndef 标签 */ + /** 对应Ndef实例,实例支持对NDEF格式的NFC标签上的NDEF数据的读写 */ ndef: string - /** NfcA 标签 */ + /** 对应NfcA实例,实例支持NFC-A (ISO 14443-3A)标准的读写 */ nfcA: string - /** NfcB 标签 */ + /** 对应NfcB实例,实例支持NFC-B (ISO 14443-3B)标准的读写 */ nfcB: string - /** NfcF 标签 */ + /** 对应NfcF实例,实例支持NFC-F (JIS 6319-4)标准的读写 */ nfcF: string - /** NfcV 标签 */ + /** 对应NfcV实例,实例支持NFC-V (ISO 15693)标准的读写 */ nfcV: string } interface TextMetrics { @@ -5644,13 +5708,17 @@ innerAudioContext.onError((res) => { complete?: UpdateVoIPChatMuteConfigCompleteCallback /** 接口调用失败的回调函数 */ fail?: UpdateVoIPChatMuteConfigFailCallback - /** 语音通话是否免提 - * - * 最低基础库: `2.10.4` */ - handsFree?: boolean /** 接口调用成功的回调函数 */ success?: UpdateVoIPChatMuteConfigSuccessCallback } + interface UpdateWeChatAppOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: UpdateWeChatAppCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: UpdateWeChatAppFailCallback + /** 接口调用成功的回调函数 */ + success?: UpdateWeChatAppSuccessCallback + } interface UploadFileOption { /** 要上传文件资源的路径 (本地路径) */ filePath: string @@ -5763,6 +5831,10 @@ innerAudioContext.onError((res) => { BSSID: string /** Wi-Fi 的 SSID */ SSID: string + /** Wi-Fi 频段单位 MHz + * + * 最低基础库: `2.12.0` */ + frequency: number /** Wi-Fi 是否安全 */ secure: boolean /** Wi-Fi 信号强度 */ @@ -5848,18 +5920,18 @@ innerAudioContext.onError((res) => { success?: WriteFileSuccessCallback } interface WriteNdefMessageOption { - /** 二进制对象数组, 需要指明 id, type 以及 payload (均为 ArrayBuffer 类型) */ - records: any[] - /** text 数组 */ - texts: any[] - /** uri 数组 */ - uris: any[] /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: WriteNdefMessageCompleteCallback /** 接口调用失败的回调函数 */ fail?: WriteNdefMessageFailCallback + /** 二进制对象数组, 需要指明 id, type 以及 payload (均为 ArrayBuffer 类型) */ + records?: any[] /** 接口调用成功的回调函数 */ success?: WriteNdefMessageSuccessCallback + /** text 数组 */ + texts?: any[] + /** uri 数组 */ + uris?: any[] } interface WxGetFileInfoOption { /** 本地文件路径 (本地路径) */ @@ -8945,7 +9017,7 @@ Page({ connect(option?: ConnectOption): void /** [IsoDep.getHistoricalBytes(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.getHistoricalBytes.html) * - * + * 获取复位信息 * * 最低基础库: `2.11.2` */ getHistoricalBytes(option?: GetHistoricalBytesOption): void @@ -8955,12 +9027,6 @@ Page({ * * 最低基础库: `2.11.2` */ getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void - /** [IsoDep.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.isConnected.html) - * - * 检查连接状态 - * - * 最低基础库: `2.11.2` */ - isConnected(option?: IsConnectedOption): void /** [IsoDep.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.setTimeout.html) * * 设置超时时间 @@ -9161,6 +9227,12 @@ Page({ ): void } interface MapContext { + /** [MapContext.addCustomLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addCustomLayer.html) + * + * 添加个性化图层。 + * + * 最低基础库: `2.12.0` */ + addCustomLayer(option: AddCustomLayerOption): void /** [MapContext.getCenterLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getCenterLocation.html) * * 获取当前地图中心的经纬度。返回的是 gcj02 坐标系,可以用于 [wx.openLocation()](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.openLocation.html) */ @@ -9201,6 +9273,12 @@ Page({ * * 最低基础库: `1.2.0` */ moveToLocation(option: MoveToLocationOption): void + /** [MapContext.removeCustomLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeCustomLayer.html) + * + * 移除个性化图层。 + * + * 最低基础库: `2.12.0` */ + removeCustomLayer(option: RemoveCustomLayerOption): void /** [MapContext.setCenterOffset(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setCenterOffset.html) * * 设置地图中心点偏移,向后向下为增长,屏幕比例范围(0.25~0.75),默认偏移为[0.5, 0.5] @@ -9354,12 +9432,6 @@ Page({ * * 最低基础库: `2.11.2` */ getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void - /** [MifareClassic.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.isConnected.html) - * - * 检查连接状态 - * - * 最低基础库: `2.11.2` */ - isConnected(option?: IsConnectedOption): void /** [MifareClassic.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.setTimeout.html) * * 设置超时时间 @@ -9392,12 +9464,6 @@ Page({ * * 最低基础库: `2.11.2` */ getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void - /** [MifareUltralight.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.isConnected.html) - * - * 检查连接状态 - * - * 最低基础库: `2.11.2` */ - isConnected(option?: IsConnectedOption): void /** [MifareUltralight.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.setTimeout.html) * * 设置超时时间 @@ -9414,16 +9480,22 @@ Page({ interface NFCAdapter { /** [NFCAdapter.offDiscovered(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.offDiscovered.html) * - * + * 取消监听 NFC Tag * * 最低基础库: `2.11.2` */ - offDiscovered(callback: (...args: any[]) => any): void + offDiscovered( + /** 的回调函数 */ + callback: OffDiscoveredCallback + ): void /** [NFCAdapter.onDiscovered(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.onDiscovered.html) * - * + * 监听 NFC Tag * * 最低基础库: `2.11.2` */ - onDiscovered(callback: (...args: any[]) => any): void + onDiscovered( + /** 的回调函数 */ + callback: OnDiscoveredCallback + ): void /** [NFCAdapter.startDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.startDiscovery.html) * * @@ -9438,49 +9510,49 @@ Page({ stopDiscovery(option?: StopDiscoveryOption): void /** [[IsoDep](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.html) NFCAdapter.getIsoDep()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getIsoDep.html) * - * + * 获取IsoDep实例,实例支持ISO-DEP (ISO 14443-4)标准的读写 * * 最低基础库: `2.11.2` */ getIsoDep(): IsoDep /** [[MifareClassic](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.html) NFCAdapter.getMifareClassic()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getMifareClassic.html) * - * + * 获取MifareClassic实例,实例支持MIFARE Classic标签的读写 * * 最低基础库: `2.11.2` */ getMifareClassic(): MifareClassic /** [[MifareUltralight](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.html) NFCAdapter.getMifareUltralight()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getMifareUltralight.html) * - * + * 获取MifareUltralight实例,实例支持MIFARE Ultralight标签的读写 * * 最低基础库: `2.11.2` */ getMifareUltralight(): MifareUltralight /** [[Ndef](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.html) NFCAdapter.getNdef()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNdef.html) * - * + * 获取Ndef实例,实例支持对NDEF格式的NFC标签上的NDEF数据的读写 * * 最低基础库: `2.11.2` */ getNdef(): Ndef /** [[NfcA](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.html) NFCAdapter.getNfcA()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcA.html) * - * + * 获取NfcA实例,实例支持NFC-A (ISO 14443-3A)标准的读写 * * 最低基础库: `2.11.2` */ getNfcA(): NfcA /** [[NfcB](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.html) NFCAdapter.getNfcB()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcB.html) * - * + * 获取NfcB实例,实例支持NFC-B (ISO 14443-3B)标准的读写 * * 最低基础库: `2.11.2` */ getNfcB(): NfcB /** [[NfcF](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.html) NFCAdapter.getNfcF()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcF.html) * - * + * 获取NfcF实例,实例支持NFC-F (JIS 6319-4)标准的读写 * * 最低基础库: `2.11.2` */ getNfcF(): NfcF /** [[NfcV](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.html) NFCAdapter.getNfcV()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcV.html) * - * + * 获取NfcV实例,实例支持NFC-V (ISO 15693)标准的读写 * * 最低基础库: `2.11.2` */ getNfcV(): NfcV @@ -9524,12 +9596,6 @@ Page({ * * 最低基础库: `2.11.2` */ connect(option?: ConnectOption): void - /** [Ndef.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.isConnected.html) - * - * 检查连接状态 - * - * 最低基础库: `2.11.2` */ - isConnected(option?: IsConnectedOption): void /** [Ndef.offNdefMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.offNdefMessage.html) * * 取消监听 Ndef 消息 @@ -9570,7 +9636,7 @@ Page({ connect(option?: ConnectOption): void /** [NfcA.getAtqa(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getAtqa.html) * - * + * 获取ATQA信息 * * 最低基础库: `2.11.2` */ getAtqa(option?: GetAtqaOption): void @@ -9582,16 +9648,10 @@ Page({ getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void /** [NfcA.getSak(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getSak.html) * - * + * 获取SAK信息 * * 最低基础库: `2.11.2` */ getSak(option?: GetSakOption): void - /** [NfcA.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.isConnected.html) - * - * 检查连接状态 - * - * 最低基础库: `2.11.2` */ - isConnected(option?: IsConnectedOption): void /** [NfcA.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.setTimeout.html) * * 设置超时时间 @@ -9624,12 +9684,6 @@ Page({ * * 最低基础库: `2.11.2` */ getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void - /** [NfcB.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.isConnected.html) - * - * 检查连接状态 - * - * 最低基础库: `2.11.2` */ - isConnected(option?: IsConnectedOption): void /** [NfcB.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.setTimeout.html) * * 设置超时时间 @@ -9662,12 +9716,6 @@ Page({ * * 最低基础库: `2.11.2` */ getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void - /** [NfcF.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.isConnected.html) - * - * 检查连接状态 - * - * 最低基础库: `2.11.2` */ - isConnected(option?: IsConnectedOption): void /** [NfcF.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.setTimeout.html) * * 设置超时时间 @@ -9700,12 +9748,6 @@ Page({ * * 最低基础库: `2.11.2` */ getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void - /** [NfcV.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.isConnected.html) - * - * 检查连接状态 - * - * 最低基础库: `2.11.2` */ - isConnected(option?: IsConnectedOption): void /** [NfcV.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.setTimeout.html) * * 设置超时时间 @@ -9719,6 +9761,48 @@ Page({ * 最低基础库: `2.11.2` */ transceive(option: TransceiveOption): void } + interface Nfcrwerror { + /** 错误信息 + * + * | 错误码 | 错误信息 | 说明 | + * | - | - | - | + * | 13000 | 设备不支持NFC | | + * | 13001 | 系统NFC开关未打开 | | + * | 13010 | 未知错误 | | + * | 13019 | user is not authorized | 用户未授权 | + * | 13011 | invalid parameter | 参数无效 | + * | 13012 | parse NdefMessage failed | 将参数解析为NdefMessage失败 | + * | 13021 | NFC discovery already started | 已经开始NFC扫描 | + * | 13018 | NFC discovery has not started | 尝试在未开始NFC扫描时停止NFC扫描 | + * | 13022 | Tech already connected | 标签已经连接 | + * | 13023 | Tech has not connected | 尝试在未连接标签时断开连接 | + * | 13013 | NFC tag has not been discovered | 未扫描到NFC标签 | + * | 13014 | invalid tech | 无效的标签技术 | + * | 13015 | unavailable tech | 从标签上获取对应技术失败 | + * | 13024 | function not support | 当前标签技术不支持该功能 | + * | 13017 | system internal error | 相关读写操作失败 | + * | 13016 | connect fail | 连接失败 | */ errMsg: string + /** 错误码 + * + * | 错误码 | 错误信息 | 说明 | + * | - | - | - | + * | 13000 | 设备不支持NFC | | + * | 13001 | 系统NFC开关未打开 | | + * | 13010 | 未知错误 | | + * | 13019 | user is not authorized | 用户未授权 | + * | 13011 | invalid parameter | 参数无效 | + * | 13012 | parse NdefMessage failed | 将参数解析为NdefMessage失败 | + * | 13021 | NFC discovery already started | 已经开始NFC扫描 | + * | 13018 | NFC discovery has not started | 尝试在未开始NFC扫描时停止NFC扫描 | + * | 13022 | Tech already connected | 标签已经连接 | + * | 13023 | Tech has not connected | 尝试在未连接标签时断开连接 | + * | 13013 | NFC tag has not been discovered | 未扫描到NFC标签 | + * | 13014 | invalid tech | 无效的标签技术 | + * | 13015 | unavailable tech | 从标签上获取对应技术失败 | + * | 13024 | function not support | 当前标签技术不支持该功能 | + * | 13017 | system internal error | 相关读写操作失败 | + * | 13016 | connect fail | 连接失败 | */ errCode: number + } interface NodesRef { /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.boundingClientRect(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.boundingClientRect.html) * @@ -10110,82 +10194,6 @@ Page({ callback: OnHeadersReceivedCallback ): void } - interface RewardedVideoAd { - /** [Promise RewardedVideoAd.load()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.load.html) - * - * 加载激励视频广告。 */ - load(): Promise - /** [Promise RewardedVideoAd.show()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.show.html) - * - * 显示激励视频广告。激励视频广告将从屏幕下方推入。 */ - show(): Promise - /** [RewardedVideoAd.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.destroy.html) - * - * 销毁激励视频广告实例。 - * - * 最低基础库: `2.8.0` */ - destroy(): void - /** [RewardedVideoAd.offClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offClose.html) - * - * 取消监听用户点击 `关闭广告` 按钮的事件 */ - offClose( - /** 用户点击 `关闭广告` 按钮的事件的回调函数 */ - callback: OffCloseCallback - ): void - /** [RewardedVideoAd.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offError.html) - * - * 取消监听激励视频错误事件 */ - offError( - /** 激励视频错误事件的回调函数 */ - callback: OffErrorCallback - ): void - /** [RewardedVideoAd.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offLoad.html) - * - * 取消监听激励视频广告加载事件 */ - offLoad( - /** 激励视频广告加载事件的回调函数 */ - callback: OffLoadCallback - ): void - /** [RewardedVideoAd.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onClose.html) - * - * 监听用户点击 `关闭广告` 按钮的事件。 */ - onClose( - /** 用户点击 `关闭广告` 按钮的事件的回调函数 */ - callback: RewardedVideoAdOnCloseCallback - ): void - /** [RewardedVideoAd.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onError.html) - * - * 监听激励视频错误事件。 - * - * **错误码信息与解决方案表** - * - * - * 错误码是通过onError获取到的错误信息。调试期间,可以通过异常返回来捕获信息。 - * 在小程序发布上线之后,如果遇到异常问题,可以在[“运维中心“](https://mp.weixin.qq.com/)里面搜寻错误日志,还可以针对异常返回加上适当的监控信息。 - * - * | 代码 | 异常情况 | 理由 | 解决方案 | - * | ------ | -------------- | --------------- | -------------------------- | - * | 1000 | 后端错误调用失败 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。 | - * | 1001 | 参数错误 | 使用方法错误 | 可以前往developers.weixin.qq.com确认具体教程(小程序和小游戏分别有各自的教程,可以在顶部选项中,“设计”一栏的右侧进行切换。| - * | 1002 | 广告单元无效 | 可能是拼写错误、或者误用了其他APP的广告ID | 请重新前往mp.weixin.qq.com确认广告位ID。 | - * | 1003 | 内部错误 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。| - * | 1004 | 无适合的广告 | 广告不是每一次都会出现,这次没有出现可能是由于该用户不适合浏览广告 | 属于正常情况,且开发者需要针对这种情况做形态上的兼容。 | - * | 1005 | 广告组件审核中 | 你的广告正在被审核,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。| - * | 1006 | 广告组件被驳回 | 你的广告审核失败,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。| - * | 1007 | 广告组件被驳回 | 你的广告能力已经被封禁,封禁期间无法展现广告 | 请前往mp.weixin.qq.com确认小程序广告封禁状态。 | - * | 1008 | 广告单元已关闭 | 该广告位的广告能力已经被关闭 | 请前往mp.weixin.qq.com重新打开对应广告位的展现。| */ - onError( - /** 激励视频错误事件的回调函数 */ - callback: RewardedVideoAdOnErrorCallback - ): void - /** [RewardedVideoAd.onLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onLoad.html) - * - * 监听激励视频广告加载事件。 */ - onLoad( - /** 激励视频广告加载事件的回调函数 */ - callback: OnLoadCallback - ): void - } interface SelectorQuery { /** [[NodesRef](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.html) SelectorQuery.exec(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.exec.html) * @@ -10984,6 +10992,11 @@ logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3]) * * 获取 NFC 实例 * + * **示例代码** + * + * + * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/1WsbDwmb75ig) + * * 最低基础库: `2.11.2` */ getNFCAdapter(): NFCAdapter /** [[OffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.html) wx.createOffscreenCanvas()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html) @@ -11045,14 +11058,6 @@ wx.request({ }) ``` */ request(option: RequestOption): RequestTask - /** [[RewardedVideoAd](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.html) wx.createRewardedVideoAd(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/wx.createRewardedVideoAd.html) - * - * 创建激励视频广告组件。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API(小游戏端要求 >= 2.0.4, 小程序端要求 >= 2.6.0)。调用该方法创建的激励视频广告是一个单例(小游戏端是全局单例,小程序端是页面内单例,在小程序端的单例对象不允许跨页面使用)。 - * - * 最低基础库: `2.0.4` */ - createRewardedVideoAd( - option: CreateRewardedVideoAdOption - ): RewardedVideoAd /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) wx.createSelectorQuery()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html) * * 返回一个 SelectorQuery 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createSelectorQuery()` 来代替。 @@ -11779,6 +11784,18 @@ wx.createBLEConnection({ >( option?: TOption ): PromisifySuccessResult + /** [wx.disableAlertBeforeUnload(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.disableAlertBeforeUnload.html) + * + * 关闭小程序页面返回询问对话框 + * + * 最低基础库: `2.12.0` */ + disableAlertBeforeUnload(option?: DisableAlertBeforeUnloadOption): void + /** [wx.enableAlertBeforeUnload(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.enableAlertBeforeUnload.html) + * + * 开启小程序页面返回询问对话框 + * + * 最低基础库: `2.12.0` */ + enableAlertBeforeUnload(option: EnableAlertBeforeUnloadOption): void /** [wx.exitVoIPChat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.exitVoIPChat.html) * * 退出(销毁)实时语音通话 @@ -12621,18 +12638,26 @@ wx.hideKeyboard({ ): PromisifySuccessResult /** [wx.hideShareMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.hideShareMenu.html) * -* 隐藏转发按钮 +* 隐藏当前页面的转发按钮 +* +* **** +* +* ## 注意事项 +* - "shareAppMessage"表示“发送给朋友”按钮,"shareTimeline"表示“分享到朋友圈”按钮 +* - 隐藏“发送给朋友”按钮时必须同时隐藏“分享到朋友圈”按钮,隐藏“分享到朋友圈”按钮时则允许不隐藏“发送给朋友”按钮 * * **示例代码** * * * ```js -wx.hideShareMenu() +wx.hideShareMenu({ + menus: ['shareAppMessage', 'shareTimeline'] +}) ``` * * 最低基础库: `1.1.0` */ hideShareMenu( - option?: TOption + option: TOption ): PromisifySuccessResult /** [wx.hideTabBar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBar.html) * @@ -12717,6 +12742,14 @@ wx.login({ }) ``` */ login(option?: LoginOption): void + /** [wx.makeBluetoothPair(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.makeBluetoothPair.html) + * + * 蓝牙配对接口,仅安卓使用。安卓上蓝牙连接时,部分设备需先配对。 + * + * 最低基础库: `2.12.0` */ + makeBluetoothPair( + option: TOption + ): PromisifySuccessResult /** [wx.makePhoneCall(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/phone/wx.makePhoneCall.html) * * 拨打电话 @@ -13389,14 +13422,15 @@ wx.onBLEConnectionStateChange(function(res) { /** 音乐停止事件的回调函数 */ callback: OnBackgroundAudioStopCallback ): void - /** [wx.onBackgroundFetchData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.onBackgroundFetchData.html) + /** [wx.onBackgroundFetchData(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.onBackgroundFetchData.html) * - * 收到 backgroundFetch 数据时的回调 + * 监听收到 backgroundFetch 数据时的回调 * * 最低基础库: `2.8.0` */ - onBackgroundFetchData( - option?: TOption - ): PromisifySuccessResult + onBackgroundFetchData( + /** 的回调函数 */ + callback: OnBackgroundFetchDataCallback + ): void /** [wx.onBeaconServiceChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconServiceChange.html) * * 监听 iBeacon 服务状态变化事件,仅能注册一个监听 @@ -13915,6 +13949,12 @@ wx.openSetting({ openSetting( option: TOption ): PromisifySuccessResult + /** [wx.openVideoEditor(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.openVideoEditor.html) + * + * 打开视频编辑器 + * + * 最低基础库: `2.12.0` */ + openVideoEditor(option: OpenVideoEditorOption): void /** [wx.pageScrollTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/wx.pageScrollTo.html) * * 将页面滚动到目标位置,支持选择器和滚动距离两种方式定位 @@ -14034,6 +14074,14 @@ wx.previewImage({ previewImage( option: TOption ): PromisifySuccessResult + /** [wx.previewMedia(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewMedia.html) + * + * 预览图片和视频。 + * + * 最低基础库: `2.12.0` */ + previewMedia( + option: TOption + ): PromisifySuccessResult /** [wx.reLaunch(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.reLaunch.html) * * 关闭所有页面,打开到应用内的某个页面 @@ -14932,12 +14980,19 @@ wx.showModal({ * * 显示当前页面的转发按钮 * +* **** +* +* ## 注意事项 +* - "shareAppMessage"表示“发送给朋友”按钮,"shareTimeline"表示“分享到朋友圈”按钮 +* - 显示“分享到朋友圈”按钮时必须同时显示“发送给朋友”按钮,显示“发送给朋友”按钮时则允许不显示“分享到朋友圈”按钮 +* * **示例代码** * * * ```js wx.showShareMenu({ - withShareTicket: true + withShareTicket: true, + menus: ['shareAppMessage', 'shareTimeline'] }) ``` * @@ -15030,7 +15085,7 @@ wx.startBeaconDiscovery({ * **示例代码** * * -* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K) +* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/m7klFDmZ72i1) * * ```js // 以微信硬件平台的蓝牙智能灯为例,主服务的 UUID 是 FEE7。传入这个参数,只搜索主服务 UUID 为 FEE7 的设备 @@ -15464,16 +15519,6 @@ wx.stopWifi({ stopWifi( option?: TOption ): PromisifySuccessResult - /** [wx.subscribeVoIPVideoMembers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.subscribeVoIPVideoMembers.html) - * - * 订阅关系,调用后 `onVoIPVideoMembersChanged` 事件仅返回订阅成员的消息。 - * - * 最低基础库: `2.11.0` */ - subscribeVoIPVideoMembers< - TOption extends SubscribeVoIPVideoMembersOption - >( - option?: TOption - ): PromisifySuccessResult /** [wx.switchTab(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.switchTab.html) * * 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面 @@ -15531,6 +15576,14 @@ wx.updateShareMenu({ >( option: TOption ): PromisifySuccessResult + /** [wx.updateWeChatApp(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/wx.updateWeChatApp.html) + * + * 更新客户端版本。当判断用户小程序所在客户端版本过低时,可使用该接口跳转到更新微信页面。 + * + * 最低基础库: `2.12.0` */ + updateWeChatApp( + option?: TOption + ): PromisifySuccessResult /** [wx.vibrateLong(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/vibrate/wx.vibrateLong.html) * * 使手机发生较长时间的振动(400 ms) @@ -15614,6 +15667,12 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type AddCardSuccessCallback = (result: AddCardSuccessCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type AddCustomLayerCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type AddCustomLayerFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type AddCustomLayerSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type AddPhoneContactCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type AddPhoneContactFailCallback = (res: GeneralCallbackResult) => void @@ -15884,6 +15943,18 @@ wx.writeBLECharacteristicValue({ result: CreateBLEPeripheralServerSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type DisableAlertBeforeUnloadCompleteCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用失败的回调函数 */ + type DisableAlertBeforeUnloadFailCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用成功的回调函数 */ + type DisableAlertBeforeUnloadSuccessCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type DownloadFileCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type DownloadFileFailCallback = (res: GeneralCallbackResult) => void @@ -15895,6 +15966,18 @@ wx.writeBLECharacteristicValue({ type DownloadTaskOnProgressUpdateCallback = ( result: DownloadTaskOnProgressUpdateCallbackResult ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type EnableAlertBeforeUnloadCompleteCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用失败的回调函数 */ + type EnableAlertBeforeUnloadFailCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用成功的回调函数 */ + type EnableAlertBeforeUnloadSuccessCallback = ( + res: GeneralCallbackResult + ) => void /** 事件监听函数 */ type EventCallback = ( /** 触发事件参数 */ @@ -16411,14 +16494,6 @@ wx.writeBLECharacteristicValue({ result: InterstitialAdOnErrorCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type IsConnectedCompleteCallback = (res: GeneralCallbackResult) => void - /** 接口调用失败的回调函数 */ - type IsConnectedFailCallback = (res: GeneralCallbackResult) => void - /** 接口调用成功的回调函数 */ - type IsConnectedSuccessCallback = ( - result: IsConnectedSuccessCallbackResult - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type JoinVoIPChatCompleteCallback = (res: JoinVoIPChatError) => void /** 接口调用失败的回调函数 */ type JoinVoIPChatFailCallback = (res: JoinVoIPChatError) => void @@ -16445,6 +16520,14 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type LoginSuccessCallback = (result: LoginSuccessCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type MakeBluetoothPairCompleteCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用失败的回调函数 */ + type MakeBluetoothPairFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type MakeBluetoothPairSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type MakePhoneCallCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type MakePhoneCallFailCallback = (res: GeneralCallbackResult) => void @@ -16553,6 +16636,8 @@ wx.writeBLECharacteristicValue({ res: GeneralCallbackResult ) => void type OffCloseCallback = (res: GeneralCallbackResult) => void + /** 的回调函数 */ + type OffDiscoveredCallback = (res: GeneralCallbackResult) => void /** 音频自然播放至结束的事件的回调函数 */ type OffEndedCallback = (res: GeneralCallbackResult) => void type OffErrorCallback = (res: GeneralCallbackResult) => void @@ -16560,6 +16645,7 @@ wx.writeBLECharacteristicValue({ type OffHeadersReceivedCallback = (res: GeneralCallbackResult) => void /** 开始监听数据包消息的事件的回调函数 */ type OffListeningCallback = (res: GeneralCallbackResult) => void + /** 插屏广告加载事件的回调函数 */ type OffLoadCallback = (res: GeneralCallbackResult) => void /** mDNS 服务停止搜索的事件的回调函数 */ type OffLocalServiceDiscoveryStopCallback = ( @@ -16639,17 +16725,9 @@ wx.writeBLECharacteristicValue({ type OnBackgroundAudioPlayCallback = (res: GeneralCallbackResult) => void /** 音乐停止事件的回调函数 */ type OnBackgroundAudioStopCallback = (res: GeneralCallbackResult) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type OnBackgroundFetchDataCompleteCallback = ( - res: GeneralCallbackResult - ) => void - /** 接口调用失败的回调函数 */ - type OnBackgroundFetchDataFailCallback = ( - res: GeneralCallbackResult - ) => void - /** 接口调用成功的回调函数 */ - type OnBackgroundFetchDataSuccessCallback = ( - res: GeneralCallbackResult + /** 的回调函数 */ + type OnBackgroundFetchDataCallback = ( + result: OnBackgroundFetchDataCallbackResult ) => void /** iBeacon 服务状态变化事件的回调函数 */ type OnBeaconServiceChangeCallback = ( @@ -16688,6 +16766,8 @@ wx.writeBLECharacteristicValue({ type OnDeviceMotionChangeCallback = ( result: OnDeviceMotionChangeCallbackResult ) => void + /** 的回调函数 */ + type OnDiscoveredCallback = (result: OnDiscoveredCallbackResult) => void type OnEndedCallback = (res: GeneralCallbackResult) => void /** 已录制完指定帧大小的文件事件的回调函数 */ type OnFrameRecordedCallback = ( @@ -16714,6 +16794,7 @@ wx.writeBLECharacteristicValue({ ) => void /** 开始监听数据包消息的事件的回调函数 */ type OnListeningCallback = (res: GeneralCallbackResult) => void + /** 插屏广告加载事件的回调函数 */ type OnLoadCallback = (res: GeneralCallbackResult) => void /** mDNS 服务停止搜索的事件的回调函数 */ type OnLocalServiceDiscoveryStopCallback = ( @@ -16762,9 +16843,7 @@ wx.writeBLECharacteristicValue({ type OnSeekedCallback = (res: GeneralCallbackResult) => void type OnSeekingCallback = (res: GeneralCallbackResult) => void /** WebSocket 连接关闭事件的回调函数 */ - type OnSocketCloseCallback = ( - result: SocketTaskOnCloseCallbackResult - ) => void + type OnSocketCloseCallback = (result: OnCloseCallbackResult) => void /** WebSocket 错误事件的回调函数 */ type OnSocketErrorCallback = ( result: UDPSocketOnErrorCallbackResult @@ -16843,6 +16922,14 @@ wx.writeBLECharacteristicValue({ result: OpenSettingSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type OpenVideoEditorCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type OpenVideoEditorFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type OpenVideoEditorSuccessCallback = ( + result: OpenVideoEditorSuccessCallbackResult + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type PageScrollToCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type PageScrollToFailCallback = (res: GeneralCallbackResult) => void @@ -16911,6 +16998,12 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type PreviewImageSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type PreviewMediaCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type PreviewMediaFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type PreviewMediaSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ReLaunchCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type ReLaunchFailCallback = (res: GeneralCallbackResult) => void @@ -16955,6 +17048,14 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type RedoSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type RemoveCustomLayerCompleteCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用失败的回调函数 */ + type RemoveCustomLayerFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type RemoveCustomLayerSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type RemoveFormatCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type RemoveFormatFailCallback = (res: GeneralCallbackResult) => void @@ -17034,14 +17135,6 @@ wx.writeBLECharacteristicValue({ type ResumeFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type ResumeSuccessCallback = (res: GeneralCallbackResult) => void - /** 用户点击 `关闭广告` 按钮的事件的回调函数 */ - type RewardedVideoAdOnCloseCallback = ( - result: RewardedVideoAdOnCloseCallbackResult - ) => void - /** 激励视频错误事件的回调函数 */ - type RewardedVideoAdOnErrorCallback = ( - result: RewardedVideoAdOnErrorCallbackResult - ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type RmdirCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ @@ -17365,9 +17458,7 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type ShowToastSuccessCallback = (res: GeneralCallbackResult) => void /** WebSocket 连接关闭事件的回调函数 */ - type SocketTaskOnCloseCallback = ( - result: SocketTaskOnCloseCallbackResult - ) => void + type SocketTaskOnCloseCallback = (result: OnCloseCallbackResult) => void /** WebSocket 接受到服务器的消息事件的回调函数 */ type SocketTaskOnMessageCallback = ( result: SocketTaskOnMessageCallbackResult @@ -17669,18 +17760,6 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type StopWifiSuccessCallback = (res: WifiError) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type SubscribeVoIPVideoMembersCompleteCallback = ( - res: GeneralCallbackResult - ) => void - /** 接口调用失败的回调函数 */ - type SubscribeVoIPVideoMembersFailCallback = ( - res: GeneralCallbackResult - ) => void - /** 接口调用成功的回调函数 */ - type SubscribeVoIPVideoMembersSuccessCallback = ( - res: GeneralCallbackResult - ) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SwitchCameraCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type SwitchCameraFailCallback = (res: GeneralCallbackResult) => void @@ -17765,6 +17844,12 @@ wx.writeBLECharacteristicValue({ res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type UpdateWeChatAppCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type UpdateWeChatAppFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type UpdateWeChatAppSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type UploadFileCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type UploadFileFailCallback = (res: GeneralCallbackResult) => void From bdf14e97b5fdf8b5db00634604aacdca1d292654 Mon Sep 17 00:00:00 2001 From: wechat-miniprogram-admin Date: Tue, 28 Jul 2020 19:37:42 +0800 Subject: [PATCH 024/205] 2.12.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5f57f1a..0c429d8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.11.3-beta", + "version": "2.12.0", "beta": "true", "description": "Type definitions for APIs of Wechat Mini Program in TypeScript", "main": "./index.d.ts", From 97bd6438095becbd604f5d369a9a467c2f784996 Mon Sep 17 00:00:00 2001 From: wechat-miniprogram-admin Date: Tue, 28 Jul 2020 22:42:14 +0800 Subject: [PATCH 025/205] 2.12.0 --- types/wx/lib.wx.api.d.ts | 132 ++------------------------------------- 1 file changed, 4 insertions(+), 128 deletions(-) diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index e0a25bf..798a950 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -1343,10 +1343,6 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 一个数值数组,包含所有阈值。 */ thresholds?: number[] } - interface CreateInterstitialAdOption { - /** 广告单元 id */ - adUnitId: string - } interface CreateMediaRecorderOption { /** 指定录制的时长(s),到达自动停止。最大 7200,最小 5 */ duration?: number @@ -2883,23 +2879,6 @@ innerAudioContext.onError((res) => { /** 宽度 */ width: number } - interface InterstitialAdOnErrorCallbackResult { - /** 错误码 - * - * 可选值: - * - 1000: 后端接口调用失败; - * - 1001: 参数错误; - * - 1002: 广告单元无效; - * - 1003: 内部错误; - * - 1004: 无合适的广告; - * - 1005: 广告组件审核中; - * - 1006: 广告组件被驳回; - * - 1007: 广告组件被封禁; - * - 1008: 广告单元已关闭; */ - errCode: 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 - /** 错误信息 */ - errMsg: string - } interface JoinVoIPChatOption { /** 小游戏内此房间/群聊的 ID。同一时刻传入相同 groupId 的用户会进入到同个实时语音房间。 */ groupId: string @@ -3850,7 +3829,7 @@ innerAudioContext.onError((res) => { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: PreviewMediaCompleteCallback /** 当前显示的资源序号 */ - current?: current + current?: number /** 接口调用失败的回调函数 */ fail?: PreviewMediaFailCallback /** 接口调用成功的回调函数 */ @@ -8911,97 +8890,6 @@ Page({ margins?: Margins ): IntersectionObserver } - interface InterstitialAd { - /** [InterstitialAd.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.destroy.html) - * - * 销毁插屏广告实例。 - * - * 最低基础库: `2.8.0` */ - destroy(): void - /** [InterstitialAd.offClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offClose.html) - * - * 取消监听插屏广告关闭事件 */ - offClose( - /** 插屏广告关闭事件的回调函数 */ - callback: OffCloseCallback - ): void - /** [InterstitialAd.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offError.html) - * - * 取消监听插屏错误事件 */ - offError( - /** 插屏错误事件的回调函数 */ - callback: OffErrorCallback - ): void - /** [InterstitialAd.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offLoad.html) - * - * 取消监听插屏广告加载事件 */ - offLoad( - /** 插屏广告加载事件的回调函数 */ - callback: OffLoadCallback - ): void - /** [InterstitialAd.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onClose.html) - * - * 监听插屏广告关闭事件。 */ - onClose( - /** 插屏广告关闭事件的回调函数 */ - callback: UDPSocketOnCloseCallback - ): void - /** [InterstitialAd.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onError.html) - * - * 监听插屏错误事件。 - * - * **错误码信息与解决方案表** - * - * - * 错误码是通过onError获取到的错误信息。调试期间,可以通过异常返回来捕获信息。 - * 在小程序发布上线之后,如果遇到异常问题,可以在[“运维中心“](https://mp.weixin.qq.com/)里面搜寻错误日志,还可以针对异常返回加上适当的监控信息。 - * - * | 代码 | 异常情况 | 理由 | 解决方案 | - * | ------ | -------------- | --------------- | -------------------------- | - * | 1000 | 后端错误调用失败 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。 | - * | 1001 | 参数错误 | 使用方法错误 | 可以前往developers.weixin.qq.com确认具体教程(小程序和小游戏分别有各自的教程,可以在顶部选项中,“设计”一栏的右侧进行切换。| - * | 1002 | 广告单元无效 | 可能是拼写错误、或者误用了其他APP的广告ID | 请重新前往mp.weixin.qq.com确认广告位ID。 | - * | 1003 | 内部错误 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。| - * | 1004 | 无适合的广告 | 广告不是每一次都会出现,这次没有出现可能是由于该用户不适合浏览广告 | 属于正常情况,且开发者需要针对这种情况做形态上的兼容。 | - * | 1005 | 广告组件审核中 | 你的广告正在被审核,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。| - * | 1006 | 广告组件被驳回 | 你的广告审核失败,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。| - * | 1007 | 广告组件被驳回 | 你的广告能力已经被封禁,封禁期间无法展现广告 | 请前往mp.weixin.qq.com确认小程序广告封禁状态。 | - * | 1008 | 广告单元已关闭 | 该广告位的广告能力已经被关闭 | 请前往mp.weixin.qq.com重新打开对应广告位的展现。| */ - onError( - /** 插屏错误事件的回调函数 */ - callback: InterstitialAdOnErrorCallback - ): void - /** [InterstitialAd.onLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onLoad.html) - * - * 监听插屏广告加载事件。 */ - onLoad( - /** 插屏广告加载事件的回调函数 */ - callback: OnLoadCallback - ): void - /** [Promise InterstitialAd.load()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.load.html) - * - * 加载插屏广告。 - * - * 最低基础库: `2.8.0` */ - load(): Promise - /** [Promise InterstitialAd.show()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.show.html) - * - * 显示插屏广告。 - * - * **错误码信息表** - * - * - * 如果插屏广告显示失败,InterstitialAd.show() 方法会返回一个rejected Promise,开发者可以获取到错误码及对应的错误信息。 - * - * | 代码 | 异常情况 | 理由 | - * | ------ | -------------- | -------------------------- | - * | 2001 | 触发频率限制 | 小程序启动一定时间内不允许展示插屏广告 | - * | 2002 | 触发频率限制 | 距离小程序插屏广告或者激励视频广告上次播放时间间隔不足,不允许展示插屏广告 | - * | 2003 | 触发频率限制 | 当前正在播放激励视频广告或者插屏广告,不允许再次展示插屏广告 | - * | 2004 | 广告渲染失败 | 该项错误不是开发者的异常情况,或因小程序页面切换导致广告渲染失败 | - * | 2005 | 广告调用异常 | 插屏广告实例不允许跨页面调用 | */ - show(): Promise - } interface IsoDep { /** [IsoDep.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.close.html) * @@ -10923,12 +10811,6 @@ wx.downloadFile({ /** 选项 */ options?: CreateIntersectionObserverOption ): IntersectionObserver - /** [[InterstitialAd](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.html) wx.createInterstitialAd(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/wx.createInterstitialAd.html) - * - * 创建插屏广告组件。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API。每次调用该方法创建插屏广告都会返回一个全新的实例(小程序端的插屏广告实例不允许跨页面使用)。 - * - * 最低基础库: `2.6.0` */ - createInterstitialAd(option: CreateInterstitialAdOption): InterstitialAd /** [[LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html) wx.createLivePlayerContext(string id, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/wx.createLivePlayerContext.html) * * 创建 [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 上下文 [LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html) 对象。 @@ -12657,7 +12539,7 @@ wx.hideShareMenu({ * * 最低基础库: `1.1.0` */ hideShareMenu( - option: TOption + option?: TOption ): PromisifySuccessResult /** [wx.hideTabBar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBar.html) * @@ -16489,10 +16371,6 @@ wx.writeBLECharacteristicValue({ type IntersectionObserverObserveCallback = ( result: IntersectionObserverObserveCallbackResult ) => void - /** 插屏错误事件的回调函数 */ - type InterstitialAdOnErrorCallback = ( - result: InterstitialAdOnErrorCallbackResult - ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type JoinVoIPChatCompleteCallback = (res: JoinVoIPChatError) => void /** 接口调用失败的回调函数 */ @@ -16635,6 +16513,7 @@ wx.writeBLECharacteristicValue({ type OffCharacteristicWriteRequestCallback = ( res: GeneralCallbackResult ) => void + /** 关闭事件的回调函数 */ type OffCloseCallback = (res: GeneralCallbackResult) => void /** 的回调函数 */ type OffDiscoveredCallback = (res: GeneralCallbackResult) => void @@ -16645,8 +16524,6 @@ wx.writeBLECharacteristicValue({ type OffHeadersReceivedCallback = (res: GeneralCallbackResult) => void /** 开始监听数据包消息的事件的回调函数 */ type OffListeningCallback = (res: GeneralCallbackResult) => void - /** 插屏广告加载事件的回调函数 */ - type OffLoadCallback = (res: GeneralCallbackResult) => void /** mDNS 服务停止搜索的事件的回调函数 */ type OffLocalServiceDiscoveryStopCallback = ( res: GeneralCallbackResult @@ -16794,8 +16671,6 @@ wx.writeBLECharacteristicValue({ ) => void /** 开始监听数据包消息的事件的回调函数 */ type OnListeningCallback = (res: GeneralCallbackResult) => void - /** 插屏广告加载事件的回调函数 */ - type OnLoadCallback = (res: GeneralCallbackResult) => void /** mDNS 服务停止搜索的事件的回调函数 */ type OnLocalServiceDiscoveryStopCallback = ( res: GeneralCallbackResult @@ -17799,6 +17674,7 @@ wx.writeBLECharacteristicValue({ type TranslateMarkerFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type TranslateMarkerSuccessCallback = (res: GeneralCallbackResult) => void + /** 关闭事件的回调函数 */ type UDPSocketOnCloseCallback = (res: GeneralCallbackResult) => void type UDPSocketOnErrorCallback = ( result: UDPSocketOnErrorCallbackResult From a36e18ef04db1071fa1c043346d43e8df0db5760 Mon Sep 17 00:00:00 2001 From: wechat-miniprogram-admin Date: Wed, 29 Jul 2020 20:16:47 +0800 Subject: [PATCH 026/205] 2.12.0 --- types/wx/lib.wx.api.d.ts | 271 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 261 insertions(+), 10 deletions(-) diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index 798a950..faaf6e7 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -1343,6 +1343,10 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 一个数值数组,包含所有阈值。 */ thresholds?: number[] } + interface CreateInterstitialAdOption { + /** 广告单元 id */ + adUnitId: string + } interface CreateMediaRecorderOption { /** 指定录制的时长(s),到达自动停止。最大 7200,最小 5 */ duration?: number @@ -1353,6 +1357,14 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 视频比特率(kbps),最小值 600,最大值 3000 */ videoBitsPerSecond?: number } + interface CreateRewardedVideoAdOption { + /** 广告单元 id */ + adUnitId: string + /** 是否启用多例模式,默认为false + * + * 最低基础库: `2.8.0` */ + multiton?: boolean + } /** 弹幕内容 */ interface Danmu { /** 弹幕文字 */ @@ -2879,6 +2891,23 @@ innerAudioContext.onError((res) => { /** 宽度 */ width: number } + interface InterstitialAdOnErrorCallbackResult { + /** 错误码 + * + * 可选值: + * - 1000: 后端接口调用失败; + * - 1001: 参数错误; + * - 1002: 广告单元无效; + * - 1003: 内部错误; + * - 1004: 无合适的广告; + * - 1005: 广告组件审核中; + * - 1006: 广告组件被驳回; + * - 1007: 广告组件被封禁; + * - 1008: 广告单元已关闭; */ + errCode: 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 + /** 错误信息 */ + errMsg: string + } interface JoinVoIPChatOption { /** 小游戏内此房间/群聊的 ID。同一时刻传入相同 groupId 的用户会进入到同个实时语音房间。 */ groupId: string @@ -3361,12 +3390,6 @@ innerAudioContext.onError((res) => { /** 是否有新版本 */ hasUpdate: boolean } - interface OnCloseCallbackResult { - /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ - code: number - /** 一个可读的字符串,表示连接被关闭的原因。 */ - reason: string - } interface OnCompassChangeCallbackResult { /** 精度 * @@ -4354,6 +4377,31 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: ResumeSuccessCallback } + interface RewardedVideoAdOnCloseCallbackResult { + /** 视频是否是在用户完整观看的情况下被关闭的 + * + * 最低基础库: `2.1.0` */ + isEnded: boolean + } + interface RewardedVideoAdOnErrorCallbackResult { + /** 错误码 + * + * 可选值: + * - 1000: 后端接口调用失败; + * - 1001: 参数错误; + * - 1002: 广告单元无效; + * - 1003: 内部错误; + * - 1004: 无合适的广告; + * - 1005: 广告组件审核中; + * - 1006: 广告组件被驳回; + * - 1007: 广告组件被封禁; + * - 1008: 广告单元已关闭; + * + * 最低基础库: `2.2.2` */ + errCode: 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 + /** 错误信息 */ + errMsg: string + } interface RmdirFailCallbackResult { /** 错误信息 * @@ -5007,6 +5055,12 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: CloseSuccessCallback } + interface SocketTaskOnCloseCallbackResult { + /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ + code: number + /** 一个可读的字符串,表示连接被关闭的原因。 */ + reason: string + } interface SocketTaskOnMessageCallbackResult { /** 服务器返回的消息 */ data: string | ArrayBuffer @@ -8890,6 +8944,97 @@ Page({ margins?: Margins ): IntersectionObserver } + interface InterstitialAd { + /** [InterstitialAd.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.destroy.html) + * + * 销毁插屏广告实例。 + * + * 最低基础库: `2.8.0` */ + destroy(): void + /** [InterstitialAd.offClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offClose.html) + * + * 取消监听插屏广告关闭事件 */ + offClose( + /** 插屏广告关闭事件的回调函数 */ + callback: OffCloseCallback + ): void + /** [InterstitialAd.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offError.html) + * + * 取消监听插屏错误事件 */ + offError( + /** 插屏错误事件的回调函数 */ + callback: OffErrorCallback + ): void + /** [InterstitialAd.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offLoad.html) + * + * 取消监听插屏广告加载事件 */ + offLoad( + /** 插屏广告加载事件的回调函数 */ + callback: OffLoadCallback + ): void + /** [InterstitialAd.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onClose.html) + * + * 监听插屏广告关闭事件。 */ + onClose( + /** 插屏广告关闭事件的回调函数 */ + callback: UDPSocketOnCloseCallback + ): void + /** [InterstitialAd.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onError.html) + * + * 监听插屏错误事件。 + * + * **错误码信息与解决方案表** + * + * + * 错误码是通过onError获取到的错误信息。调试期间,可以通过异常返回来捕获信息。 + * 在小程序发布上线之后,如果遇到异常问题,可以在[“运维中心“](https://mp.weixin.qq.com/)里面搜寻错误日志,还可以针对异常返回加上适当的监控信息。 + * + * | 代码 | 异常情况 | 理由 | 解决方案 | + * | ------ | -------------- | --------------- | -------------------------- | + * | 1000 | 后端错误调用失败 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。 | + * | 1001 | 参数错误 | 使用方法错误 | 可以前往developers.weixin.qq.com确认具体教程(小程序和小游戏分别有各自的教程,可以在顶部选项中,“设计”一栏的右侧进行切换。| + * | 1002 | 广告单元无效 | 可能是拼写错误、或者误用了其他APP的广告ID | 请重新前往mp.weixin.qq.com确认广告位ID。 | + * | 1003 | 内部错误 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。| + * | 1004 | 无适合的广告 | 广告不是每一次都会出现,这次没有出现可能是由于该用户不适合浏览广告 | 属于正常情况,且开发者需要针对这种情况做形态上的兼容。 | + * | 1005 | 广告组件审核中 | 你的广告正在被审核,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。| + * | 1006 | 广告组件被驳回 | 你的广告审核失败,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。| + * | 1007 | 广告组件被驳回 | 你的广告能力已经被封禁,封禁期间无法展现广告 | 请前往mp.weixin.qq.com确认小程序广告封禁状态。 | + * | 1008 | 广告单元已关闭 | 该广告位的广告能力已经被关闭 | 请前往mp.weixin.qq.com重新打开对应广告位的展现。| */ + onError( + /** 插屏错误事件的回调函数 */ + callback: InterstitialAdOnErrorCallback + ): void + /** [InterstitialAd.onLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onLoad.html) + * + * 监听插屏广告加载事件。 */ + onLoad( + /** 插屏广告加载事件的回调函数 */ + callback: OnLoadCallback + ): void + /** [Promise InterstitialAd.load()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.load.html) + * + * 加载插屏广告。 + * + * 最低基础库: `2.8.0` */ + load(): Promise + /** [Promise InterstitialAd.show()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.show.html) + * + * 显示插屏广告。 + * + * **错误码信息表** + * + * + * 如果插屏广告显示失败,InterstitialAd.show() 方法会返回一个rejected Promise,开发者可以获取到错误码及对应的错误信息。 + * + * | 代码 | 异常情况 | 理由 | + * | ------ | -------------- | -------------------------- | + * | 2001 | 触发频率限制 | 小程序启动一定时间内不允许展示插屏广告 | + * | 2002 | 触发频率限制 | 距离小程序插屏广告或者激励视频广告上次播放时间间隔不足,不允许展示插屏广告 | + * | 2003 | 触发频率限制 | 当前正在播放激励视频广告或者插屏广告,不允许再次展示插屏广告 | + * | 2004 | 广告渲染失败 | 该项错误不是开发者的异常情况,或因小程序页面切换导致广告渲染失败 | + * | 2005 | 广告调用异常 | 插屏广告实例不允许跨页面调用 | */ + show(): Promise + } interface IsoDep { /** [IsoDep.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.close.html) * @@ -10082,6 +10227,82 @@ Page({ callback: OnHeadersReceivedCallback ): void } + interface RewardedVideoAd { + /** [Promise RewardedVideoAd.load()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.load.html) + * + * 加载激励视频广告。 */ + load(): Promise + /** [Promise RewardedVideoAd.show()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.show.html) + * + * 显示激励视频广告。激励视频广告将从屏幕下方推入。 */ + show(): Promise + /** [RewardedVideoAd.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.destroy.html) + * + * 销毁激励视频广告实例。 + * + * 最低基础库: `2.8.0` */ + destroy(): void + /** [RewardedVideoAd.offClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offClose.html) + * + * 取消监听用户点击 `关闭广告` 按钮的事件 */ + offClose( + /** 用户点击 `关闭广告` 按钮的事件的回调函数 */ + callback: OffCloseCallback + ): void + /** [RewardedVideoAd.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offError.html) + * + * 取消监听激励视频错误事件 */ + offError( + /** 激励视频错误事件的回调函数 */ + callback: OffErrorCallback + ): void + /** [RewardedVideoAd.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offLoad.html) + * + * 取消监听激励视频广告加载事件 */ + offLoad( + /** 激励视频广告加载事件的回调函数 */ + callback: OffLoadCallback + ): void + /** [RewardedVideoAd.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onClose.html) + * + * 监听用户点击 `关闭广告` 按钮的事件。 */ + onClose( + /** 用户点击 `关闭广告` 按钮的事件的回调函数 */ + callback: RewardedVideoAdOnCloseCallback + ): void + /** [RewardedVideoAd.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onError.html) + * + * 监听激励视频错误事件。 + * + * **错误码信息与解决方案表** + * + * + * 错误码是通过onError获取到的错误信息。调试期间,可以通过异常返回来捕获信息。 + * 在小程序发布上线之后,如果遇到异常问题,可以在[“运维中心“](https://mp.weixin.qq.com/)里面搜寻错误日志,还可以针对异常返回加上适当的监控信息。 + * + * | 代码 | 异常情况 | 理由 | 解决方案 | + * | ------ | -------------- | --------------- | -------------------------- | + * | 1000 | 后端错误调用失败 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。 | + * | 1001 | 参数错误 | 使用方法错误 | 可以前往developers.weixin.qq.com确认具体教程(小程序和小游戏分别有各自的教程,可以在顶部选项中,“设计”一栏的右侧进行切换。| + * | 1002 | 广告单元无效 | 可能是拼写错误、或者误用了其他APP的广告ID | 请重新前往mp.weixin.qq.com确认广告位ID。 | + * | 1003 | 内部错误 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。| + * | 1004 | 无适合的广告 | 广告不是每一次都会出现,这次没有出现可能是由于该用户不适合浏览广告 | 属于正常情况,且开发者需要针对这种情况做形态上的兼容。 | + * | 1005 | 广告组件审核中 | 你的广告正在被审核,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。| + * | 1006 | 广告组件被驳回 | 你的广告审核失败,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。| + * | 1007 | 广告组件被驳回 | 你的广告能力已经被封禁,封禁期间无法展现广告 | 请前往mp.weixin.qq.com确认小程序广告封禁状态。 | + * | 1008 | 广告单元已关闭 | 该广告位的广告能力已经被关闭 | 请前往mp.weixin.qq.com重新打开对应广告位的展现。| */ + onError( + /** 激励视频错误事件的回调函数 */ + callback: RewardedVideoAdOnErrorCallback + ): void + /** [RewardedVideoAd.onLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onLoad.html) + * + * 监听激励视频广告加载事件。 */ + onLoad( + /** 激励视频广告加载事件的回调函数 */ + callback: OnLoadCallback + ): void + } interface SelectorQuery { /** [[NodesRef](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.html) SelectorQuery.exec(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.exec.html) * @@ -10811,6 +11032,12 @@ wx.downloadFile({ /** 选项 */ options?: CreateIntersectionObserverOption ): IntersectionObserver + /** [[InterstitialAd](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.html) wx.createInterstitialAd(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/wx.createInterstitialAd.html) + * + * 创建插屏广告组件。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API。每次调用该方法创建插屏广告都会返回一个全新的实例(小程序端的插屏广告实例不允许跨页面使用)。 + * + * 最低基础库: `2.6.0` */ + createInterstitialAd(option: CreateInterstitialAdOption): InterstitialAd /** [[LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html) wx.createLivePlayerContext(string id, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/wx.createLivePlayerContext.html) * * 创建 [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 上下文 [LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html) 对象。 @@ -10940,6 +11167,14 @@ wx.request({ }) ``` */ request(option: RequestOption): RequestTask + /** [[RewardedVideoAd](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.html) wx.createRewardedVideoAd(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/wx.createRewardedVideoAd.html) + * + * 创建激励视频广告组件。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API(小游戏端要求 >= 2.0.4, 小程序端要求 >= 2.6.0)。调用该方法创建的激励视频广告是一个单例(小游戏端是全局单例,小程序端是页面内单例,在小程序端的单例对象不允许跨页面使用)。 + * + * 最低基础库: `2.0.4` */ + createRewardedVideoAd( + option: CreateRewardedVideoAdOption + ): RewardedVideoAd /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) wx.createSelectorQuery()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html) * * 返回一个 SelectorQuery 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createSelectorQuery()` 来代替。 @@ -16371,6 +16606,10 @@ wx.writeBLECharacteristicValue({ type IntersectionObserverObserveCallback = ( result: IntersectionObserverObserveCallbackResult ) => void + /** 插屏错误事件的回调函数 */ + type InterstitialAdOnErrorCallback = ( + result: InterstitialAdOnErrorCallbackResult + ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type JoinVoIPChatCompleteCallback = (res: JoinVoIPChatError) => void /** 接口调用失败的回调函数 */ @@ -16513,7 +16752,6 @@ wx.writeBLECharacteristicValue({ type OffCharacteristicWriteRequestCallback = ( res: GeneralCallbackResult ) => void - /** 关闭事件的回调函数 */ type OffCloseCallback = (res: GeneralCallbackResult) => void /** 的回调函数 */ type OffDiscoveredCallback = (res: GeneralCallbackResult) => void @@ -16524,6 +16762,7 @@ wx.writeBLECharacteristicValue({ type OffHeadersReceivedCallback = (res: GeneralCallbackResult) => void /** 开始监听数据包消息的事件的回调函数 */ type OffListeningCallback = (res: GeneralCallbackResult) => void + type OffLoadCallback = (res: GeneralCallbackResult) => void /** mDNS 服务停止搜索的事件的回调函数 */ type OffLocalServiceDiscoveryStopCallback = ( res: GeneralCallbackResult @@ -16671,6 +16910,7 @@ wx.writeBLECharacteristicValue({ ) => void /** 开始监听数据包消息的事件的回调函数 */ type OnListeningCallback = (res: GeneralCallbackResult) => void + type OnLoadCallback = (res: GeneralCallbackResult) => void /** mDNS 服务停止搜索的事件的回调函数 */ type OnLocalServiceDiscoveryStopCallback = ( res: GeneralCallbackResult @@ -16718,7 +16958,9 @@ wx.writeBLECharacteristicValue({ type OnSeekedCallback = (res: GeneralCallbackResult) => void type OnSeekingCallback = (res: GeneralCallbackResult) => void /** WebSocket 连接关闭事件的回调函数 */ - type OnSocketCloseCallback = (result: OnCloseCallbackResult) => void + type OnSocketCloseCallback = ( + result: SocketTaskOnCloseCallbackResult + ) => void /** WebSocket 错误事件的回调函数 */ type OnSocketErrorCallback = ( result: UDPSocketOnErrorCallbackResult @@ -17010,6 +17252,14 @@ wx.writeBLECharacteristicValue({ type ResumeFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type ResumeSuccessCallback = (res: GeneralCallbackResult) => void + /** 用户点击 `关闭广告` 按钮的事件的回调函数 */ + type RewardedVideoAdOnCloseCallback = ( + result: RewardedVideoAdOnCloseCallbackResult + ) => void + /** 激励视频错误事件的回调函数 */ + type RewardedVideoAdOnErrorCallback = ( + result: RewardedVideoAdOnErrorCallbackResult + ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type RmdirCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ @@ -17333,7 +17583,9 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type ShowToastSuccessCallback = (res: GeneralCallbackResult) => void /** WebSocket 连接关闭事件的回调函数 */ - type SocketTaskOnCloseCallback = (result: OnCloseCallbackResult) => void + type SocketTaskOnCloseCallback = ( + result: SocketTaskOnCloseCallbackResult + ) => void /** WebSocket 接受到服务器的消息事件的回调函数 */ type SocketTaskOnMessageCallback = ( result: SocketTaskOnMessageCallbackResult @@ -17674,7 +17926,6 @@ wx.writeBLECharacteristicValue({ type TranslateMarkerFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type TranslateMarkerSuccessCallback = (res: GeneralCallbackResult) => void - /** 关闭事件的回调函数 */ type UDPSocketOnCloseCallback = (res: GeneralCallbackResult) => void type UDPSocketOnErrorCallback = ( result: UDPSocketOnErrorCallbackResult From adb7d69f23f75965ef6e39337031ddb48ddda372 Mon Sep 17 00:00:00 2001 From: SgLy <775150558@qq.com> Date: Thu, 30 Jul 2020 17:05:25 +0800 Subject: [PATCH 027/205] feat: bump version to 3.0.0 --- CHANGELOG.md | 4 ++ README-en.md | 20 ++++---- README.md | 21 ++++---- VERSIONS.md | 26 ---------- package-lock.json | 2 +- package.json | 5 +- types/wx/lib.wx.api.d.ts | 100 +++++++++++++++++++++++++++------------ 7 files changed, 102 insertions(+), 76 deletions(-) delete mode 100644 VERSIONS.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 8431347..c6a6d37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2020-07-30 v3.0.0 +- 由于基础库接口基本向前兼容,不再与基础库保持版本同步 +- 更新 API 定义到 2.12.0 + ## 2020-06-15 v2.11.0-1 - 该版本继续合并了一部分完全相同的 interface / callback,是一个 **破坏性改动**,原本字面上引用了这些 interface / callback 的代码可能会报错。 - 为 `Component` 构造器增加第四个泛型,以允许在自定义组件上挂载自定义的字段 ([#133](https://github.com/wechat-miniprogram/api-typings/issues/133)) diff --git a/README-en.md b/README-en.md index b958f51..d658c12 100644 --- a/README-en.md +++ b/README-en.md @@ -2,6 +2,7 @@ > [中文版本](./README.md) +[![Published on DefinitelyTyped](https://img.shields.io/npm/v/@types/wechat-miniprogram?label=%40types)](https://www.npmjs.com/package/@types/wechat-miniprogram) [![Published on NPM](https://img.shields.io/npm/v/miniprogram-api-typings.svg?style=flat)](https://www.npmjs.com/package/miniprogram-api-typings) [![MIT License](https://img.shields.io/github/license/wechat-miniprogram/api-typings.svg)](https://github.com/wechat-miniprogram/api-typings) [![Travis CI Test Status](https://travis-ci.org/wechat-miniprogram/api-typings.svg?branch=master)](https://travis-ci.org/wechat-miniprogram/api-typings) @@ -10,22 +11,25 @@ Type definitions for APIs of Wechat Mini Program in TypeScript ## Install -Install by NPM: +### By DefinitelyTyped ```bash -# install definitions for latest base library -npm install miniprogram-api-typings +npm install @types/wechat-miniprogram ``` -or specify a base library version: +or: +### By standalone npm package ```bash -# install definitions for base library version 2.4.1 -npm install miniprogram-api-typings@2.4.1 +npm install miniprogram-api-typings ``` +Manually import it after installed: +- `import 'miniprogram-api-typings';` -## Versions +Or specify types in typescript config: +- 在 `tsconfig.json` 中指定 `types: ["miniprogram-api-typings"]` -Check out all available versions corresponding to base library version in [VERSIONS.md](https://github.com/wechat-miniprogram/api-typings/blob/master/VERSIONS.md) +Or reference by [Triple-Slash Directives](https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html): +- `/// ` ## Changelog diff --git a/README.md b/README.md index 60a6365..5db322b 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ > [English version](./README-en.md) +[![已在 DefinitelyTyped 发布](https://img.shields.io/npm/v/@types/wechat-miniprogram?label=%40types)](https://www.npmjs.com/package/@types/wechat-miniprogram) [![已在 NPM 发布](https://img.shields.io/npm/v/miniprogram-api-typings.svg?style=flat)](https://www.npmjs.com/package/miniprogram-api-typings) [![MIT 协议](https://img.shields.io/github/license/wechat-miniprogram/api-typings.svg)](https://github.com/wechat-miniprogram/api-typings) [![Travis CI 测试状况](https://travis-ci.org/wechat-miniprogram/api-typings.svg?branch=master)](https://travis-ci.org/wechat-miniprogram/api-typings) @@ -10,21 +11,25 @@ ## 安装 -通过 npm 安装: +### 通过 DefinitelyTyped ```bash -# 安装对应最新基础库的定义文件 -npm install miniprogram-api-typings +npm install @types/wechat-miniprogram ``` -或者通过版本号指定一个基础库版本: +或: + +### 通过独立 npm 包 ```bash -# 安装对应基础库版本 2.4.1 的定义文件 -npm install miniprogram-api-typings@2.4.1 +npm install miniprogram-api-typings ``` +安装后手动导入: +- `import 'miniprogram-api-typings';` -## 版本 +或者在 ts 配置中指定: +- 在 `tsconfig.json` 中指定 `types: ["miniprogram-api-typings"]` -所有可用的版本和对应的基础库版本,参考 [VERSIONS.md](https://github.com/wechat-miniprogram/api-typings/blob/master/VERSIONS.md) +或者通过 [三斜杠指令](https://www.tslang.cn/docs/handbook/triple-slash-directives.html) 引用: +- `/// ` ## 更新日志 diff --git a/VERSIONS.md b/VERSIONS.md deleted file mode 100644 index e8adfd6..0000000 --- a/VERSIONS.md +++ /dev/null @@ -1,26 +0,0 @@ -## 所有可用版本 - -基础库版本|npm 版本|命令 --|-|- -[v2.11.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-11-2-2020-06-08) | [2.11.3-beta](https://www.npmjs.com/package/miniprogram-api-typings/v/2.11.3-beta) | `npm install miniprogram-api-typings@2.11.3-beta` -[v2.11.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-11-2-2020-06-08) | [2.11.2-beta](https://www.npmjs.com/package/miniprogram-api-typings/v/2.11.2-beta) | `npm install miniprogram-api-typings@2.11.2-beta` -[v2.11.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-11-0-2020-04-24) | [2.11.0-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.11.0-1) | `npm install miniprogram-api-typings@2.11.0-1` -[v2.10.4](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-4-2020-03-24) | [2.10.4](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.4) | `npm install miniprogram-api-typings@2.10.4` -[v2.10.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-3-2020-03-06) | [2.10.3-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.3-1) | `npm install miniprogram-api-typings@2.10.3-1` -[v2.10.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-2-2020-02-20) | [2.10.2-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.2-1) | `npm install miniprogram-api-typings@2.10.2-1` -[v2.10.1](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-1-2020-01-14) | [2.10.1-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.1-1) | `npm install miniprogram-api-typings@2.10.1-1` -[v2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-0-2019-12-24) | [2.10.0-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.0-1) | `npm install miniprogram-api-typings@2.10.0-1` -[v2.9.4](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-9-4-2019-11-28) | [2.9.4](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.4) | `npm install miniprogram-api-typings@2.9.4` -[v2.9.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/) | [2.9.3](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.3) | `npm install miniprogram-api-typings@2.9.3` -[v2.9.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-9-2-2019-11-04) | [2.9.2](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.2) | `npm install miniprogram-api-typings@2.9.2` -[v2.9.1](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-9-1-2019-10-29) | [2.9.1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.1) | `npm install miniprogram-api-typings@2.9.1` -[v2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-9-0-2019-10-09) | [2.9.0](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.0) | `npm install miniprogram-api-typings@2.9.0` -[v2.8.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-8-3-2019-09-17) | [2.8.3-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.8.3-1) | `npm install miniprogram-api-typings@2.8.3-1` -[v2.8.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-8-2-2019-08-30) | [2.8.2](https://www.npmjs.com/package/miniprogram-api-typings/v/2.8.2) | `npm install miniprogram-api-typings@2.8.2` -[v2.8.1](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-8-1-2019-08-22) | [2.8.1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.8.1) | `npm install miniprogram-api-typings@2.8.1` -[v2.8.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-8-0-2019-07-30) | [2.8.0-2](https://www.npmjs.com/package/miniprogram-api-typings/v/2.8.0-2) | `npm install miniprogram-api-typings@2.8.0-2` -[v2.7.7](https://developers.weixin.qq.com/miniprogram/dev/framework/release/) | [2.7.7-2](https://www.npmjs.com/package/miniprogram-api-typings/v/2.7.7-2) | `npm install miniprogram-api-typings@2.7.7-2` -[v2.6.5](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-6-5-2019-04-02) | [2.6.5-2](https://www.npmjs.com/package/miniprogram-api-typings/v/2.6.5-2) | `npm install miniprogram-api-typings@2.6.5-2` -[v2.4.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/v2.html#v2-4-2-2018-12-04)|[2.4.2-2](https://www.npmjs.com/package/miniprogram-api-typings/v/2.4.2-2)|`npm install miniprogram-api-typings@2.4.2-2` -[v2.4.1](https://developers.weixin.qq.com/miniprogram/dev/framework/release/v2.html#v2-4-1-2018-11-21)|[2.4.1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.4.1)|`npm install miniprogram-api-typings@2.4.1` -[v2.4.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/v2.html#v2-4-0-2018-11-05)|[2.4.0-1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.4.0-1)|`npm install miniprogram-api-typings@2.4.0.1` \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 77124ea..f28c679 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.11.0-1", + "version": "3.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 0c429d8..26bb005 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "2.12.0", + "version": "3.0.0", "beta": "true", "description": "Type definitions for APIs of Wechat Mini Program in TypeScript", "main": "./index.d.ts", @@ -32,11 +32,10 @@ "files": [ "LICENSE", "CHANGELOG.md", - "VERSIONS.md", "README.md", "README-en.md", "index.d.ts", "typings.json", "types/" ] -} \ No newline at end of file +} diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index faaf6e7..a2bc657 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -8199,7 +8199,7 @@ ctx.draw() * 最低基础库: `2.1.0` */ offProgressUpdate( /** 下载进度变化事件的回调函数 */ - callback: OffProgressUpdateCallback + callback: DownloadTaskOffProgressUpdateCallback ): void /** [DownloadTask.onHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onHeadersReceived.html) * @@ -8739,7 +8739,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offError( /** 音频播放错误事件的回调函数 */ - callback: OffErrorCallback + callback: InnerAudioContextOffErrorCallback ): void /** [InnerAudioContext.offPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offPause.html) * @@ -8956,14 +8956,14 @@ Page({ * 取消监听插屏广告关闭事件 */ offClose( /** 插屏广告关闭事件的回调函数 */ - callback: OffCloseCallback + callback: UDPSocketOffCloseCallback ): void /** [InterstitialAd.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offError.html) * * 取消监听插屏错误事件 */ offError( /** 插屏错误事件的回调函数 */ - callback: OffErrorCallback + callback: InterstitialAdOffErrorCallback ): void /** [InterstitialAd.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offLoad.html) * @@ -10247,14 +10247,14 @@ Page({ * 取消监听用户点击 `关闭广告` 按钮的事件 */ offClose( /** 用户点击 `关闭广告` 按钮的事件的回调函数 */ - callback: OffCloseCallback + callback: RewardedVideoAdOffCloseCallback ): void /** [RewardedVideoAd.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offError.html) * * 取消监听激励视频错误事件 */ offError( /** 激励视频错误事件的回调函数 */ - callback: OffErrorCallback + callback: RewardedVideoAdOffErrorCallback ): void /** [RewardedVideoAd.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offLoad.html) * @@ -10435,14 +10435,14 @@ Component({ * 取消监听关闭事件 */ offClose( /** 关闭事件的回调函数 */ - callback: OffCloseCallback + callback: UDPSocketOffCloseCallback ): void /** [UDPSocket.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offError.html) * * 取消监听错误事件 */ offError( /** 错误事件的回调函数 */ - callback: OffErrorCallback + callback: UDPSocketOffErrorCallback ): void /** [UDPSocket.offListening(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offListening.html) * @@ -10550,7 +10550,7 @@ Component({ * 最低基础库: `2.1.0` */ offProgressUpdate( /** 上传进度变化事件的回调函数 */ - callback: OffProgressUpdateCallback + callback: UploadTaskOffProgressUpdateCallback ): void /** [UploadTask.onHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onHeadersReceived.html) * @@ -12800,7 +12800,7 @@ wx.hideShareMenu({ ): PromisifySuccessResult /** [wx.joinVoIPChat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.joinVoIPChat.html) * - * 加入 (创建) 实时语音通话,更多信息可见 [实时语音指南](#) + * 加入 (创建) 实时语音通话,更多信息可见 [实时语音指南](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/voip-chat.html) * * 最低基础库: `2.7.0` */ joinVoIPChat( @@ -14408,7 +14408,7 @@ wx.reportMonitor('1', 1) ): void /** [wx.reportPerformance(Number id, Number value, String|Array dimensions)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/wx.reportPerformance.html) * -* 小程序测速上报。使用前,需要在小程序管理后台配置。 详情参见[小程序测速](#)指南。 +* 小程序测速上报。使用前,需要在小程序管理后台配置。 详情参见[小程序测速](https://developers.weixin.qq.com/miniprogram/dev/framework/performanceReport/index.html)指南。 * * **示例代码** * @@ -16080,6 +16080,10 @@ wx.writeBLECharacteristicValue({ result: DownloadFileSuccessCallbackResult ) => void /** 下载进度变化事件的回调函数 */ + type DownloadTaskOffProgressUpdateCallback = ( + result: DownloadTaskOnProgressUpdateCallbackResult + ) => void + /** 下载进度变化事件的回调函数 */ type DownloadTaskOnProgressUpdateCallback = ( result: DownloadTaskOnProgressUpdateCallbackResult ) => void @@ -16580,6 +16584,10 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type IncludePointsSuccessCallback = (res: GeneralCallbackResult) => void /** 音频播放错误事件的回调函数 */ + type InnerAudioContextOffErrorCallback = ( + result: InnerAudioContextOnErrorCallbackResult + ) => void + /** 音频播放错误事件的回调函数 */ type InnerAudioContextOnErrorCallback = ( result: InnerAudioContextOnErrorCallbackResult ) => void @@ -16607,6 +16615,10 @@ wx.writeBLECharacteristicValue({ result: IntersectionObserverObserveCallbackResult ) => void /** 插屏错误事件的回调函数 */ + type InterstitialAdOffErrorCallback = ( + result: InterstitialAdOnErrorCallbackResult + ) => void + /** 插屏错误事件的回调函数 */ type InterstitialAdOnErrorCallback = ( result: InterstitialAdOnErrorCallbackResult ) => void @@ -16727,7 +16739,7 @@ wx.writeBLECharacteristicValue({ /** 小程序切后台事件的回调函数 */ type OffAppHideCallback = (res: GeneralCallbackResult) => void /** 小程序切前台事件的回调函数 */ - type OffAppShowCallback = (res: GeneralCallbackResult) => void + type OffAppShowCallback = (result: OnAppShowCallbackResult) => void /** 音频因为受到系统占用而被中断开始事件的回调函数 */ type OffAudioInterruptionBeginCallback = ( res: GeneralCallbackResult @@ -16736,7 +16748,7 @@ wx.writeBLECharacteristicValue({ type OffAudioInterruptionEndCallback = (res: GeneralCallbackResult) => void /** 当前外围设备被连接或断开连接事件的回调函数 */ type OffBLEPeripheralConnectionStateChangedCallback = ( - res: GeneralCallbackResult + result: OnBLEPeripheralConnectionStateChangedCallbackResult ) => void /** iBeacon 服务状态变化事件的回调函数 */ type OffBeaconServiceChangeCallback = (res: GeneralCallbackResult) => void @@ -16746,20 +16758,20 @@ wx.writeBLECharacteristicValue({ type OffCanplayCallback = (res: GeneralCallbackResult) => void /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ type OffCharacteristicReadRequestCallback = ( - res: GeneralCallbackResult + result: OnCharacteristicReadRequestCallbackResult ) => void /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */ type OffCharacteristicWriteRequestCallback = ( - res: GeneralCallbackResult + result: OnCharacteristicWriteRequestCallbackResult ) => void - type OffCloseCallback = (res: GeneralCallbackResult) => void /** 的回调函数 */ - type OffDiscoveredCallback = (res: GeneralCallbackResult) => void + type OffDiscoveredCallback = (result: OnDiscoveredCallbackResult) => void /** 音频自然播放至结束的事件的回调函数 */ type OffEndedCallback = (res: GeneralCallbackResult) => void - type OffErrorCallback = (res: GeneralCallbackResult) => void /** HTTP Response Header 事件的回调函数 */ - type OffHeadersReceivedCallback = (res: GeneralCallbackResult) => void + type OffHeadersReceivedCallback = ( + result: OnHeadersReceivedCallbackResult + ) => void /** 开始监听数据包消息的事件的回调函数 */ type OffListeningCallback = (res: GeneralCallbackResult) => void type OffLoadCallback = (res: GeneralCallbackResult) => void @@ -16768,28 +16780,35 @@ wx.writeBLECharacteristicValue({ res: GeneralCallbackResult ) => void /** mDNS 服务发现的事件的回调函数 */ - type OffLocalServiceFoundCallback = (res: GeneralCallbackResult) => void + type OffLocalServiceFoundCallback = ( + result: OnLocalServiceFoundCallbackResult + ) => void /** mDNS 服务离开的事件的回调函数 */ - type OffLocalServiceLostCallback = (res: GeneralCallbackResult) => void + type OffLocalServiceLostCallback = ( + result: OnLocalServiceLostCallbackResult + ) => void /** mDNS 服务解析失败的事件的回调函数 */ type OffLocalServiceResolveFailCallback = ( - res: GeneralCallbackResult + result: OnLocalServiceLostCallbackResult ) => void /** 实时地理位置变化事件的回调函数 */ - type OffLocationChangeCallback = (res: GeneralCallbackResult) => void + type OffLocationChangeCallback = ( + result: OnLocationChangeCallbackResult + ) => void /** 收到消息的事件的回调函数 */ - type OffMessageCallback = (res: GeneralCallbackResult) => void + type OffMessageCallback = (result: UDPSocketOnMessageCallbackResult) => void /** 实时语音通话成员视频状态变化事件的回调函数 */ type OffOnVoIPVideoMembersChangedCallback = ( - res: GeneralCallbackResult + result: OnOnVoIPVideoMembersChangedCallbackResult ) => void /** 小程序要打开的页面不存在事件的回调函数 */ - type OffPageNotFoundCallback = (res: GeneralCallbackResult) => void + type OffPageNotFoundCallback = ( + result: OnPageNotFoundCallbackResult + ) => void /** 音频暂停事件的回调函数 */ type OffPauseCallback = (res: GeneralCallbackResult) => void /** 音频播放事件的回调函数 */ type OffPlayCallback = (res: GeneralCallbackResult) => void - type OffProgressUpdateCallback = (res: GeneralCallbackResult) => void /** 音频完成跳转操作的事件的回调函数 */ type OffSeekedCallback = (res: GeneralCallbackResult) => void /** 音频进行跳转操作的事件的回调函数 */ @@ -16797,15 +16816,19 @@ wx.writeBLECharacteristicValue({ /** 音频停止事件的回调函数 */ type OffStopCallback = (res: GeneralCallbackResult) => void /** 系统主题改变事件的回调函数 */ - type OffThemeChangeCallback = (res: GeneralCallbackResult) => void + type OffThemeChangeCallback = (result: OnThemeChangeCallbackResult) => void /** 音频播放进度更新事件的回调函数 */ type OffTimeUpdateCallback = (res: GeneralCallbackResult) => void /** 未处理的 Promise 拒绝事件的回调函数 */ - type OffUnhandledRejectionCallback = (res: GeneralCallbackResult) => void + type OffUnhandledRejectionCallback = ( + result: OnUnhandledRejectionCallbackResult + ) => void /** 音频加载中事件的回调函数 */ type OffWaitingCallback = (res: GeneralCallbackResult) => void /** 窗口尺寸变化事件的回调函数 */ - type OffWindowResizeCallback = (res: GeneralCallbackResult) => void + type OffWindowResizeCallback = ( + result: OnWindowResizeCallbackResult + ) => void /** 加速度数据事件的回调函数 */ type OnAccelerometerChangeCallback = ( result: OnAccelerometerChangeCallbackResult @@ -17253,6 +17276,14 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type ResumeSuccessCallback = (res: GeneralCallbackResult) => void /** 用户点击 `关闭广告` 按钮的事件的回调函数 */ + type RewardedVideoAdOffCloseCallback = ( + result: RewardedVideoAdOnCloseCallbackResult + ) => void + /** 激励视频错误事件的回调函数 */ + type RewardedVideoAdOffErrorCallback = ( + result: RewardedVideoAdOnErrorCallbackResult + ) => void + /** 用户点击 `关闭广告` 按钮的事件的回调函数 */ type RewardedVideoAdOnCloseCallback = ( result: RewardedVideoAdOnCloseCallbackResult ) => void @@ -17926,6 +17957,11 @@ wx.writeBLECharacteristicValue({ type TranslateMarkerFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type TranslateMarkerSuccessCallback = (res: GeneralCallbackResult) => void + type UDPSocketOffCloseCallback = (res: GeneralCallbackResult) => void + /** 错误事件的回调函数 */ + type UDPSocketOffErrorCallback = ( + result: UDPSocketOnErrorCallbackResult + ) => void type UDPSocketOnCloseCallback = (res: GeneralCallbackResult) => void type UDPSocketOnErrorCallback = ( result: UDPSocketOnErrorCallbackResult @@ -17985,6 +18021,10 @@ wx.writeBLECharacteristicValue({ result: UploadFileSuccessCallbackResult ) => void /** 上传进度变化事件的回调函数 */ + type UploadTaskOffProgressUpdateCallback = ( + result: UploadTaskOnProgressUpdateCallbackResult + ) => void + /** 上传进度变化事件的回调函数 */ type UploadTaskOnProgressUpdateCallback = ( result: UploadTaskOnProgressUpdateCallbackResult ) => void From d7161a243938ced7e6a81f64ddff8c95272eed0a Mon Sep 17 00:00:00 2001 From: SgLy <775150558@qq.com> Date: Mon, 3 Aug 2020 19:45:41 +0800 Subject: [PATCH 028/205] feat: update api tp baselib --- package.json | 2 +- types/wx/lib.wx.api.d.ts | 200 +++++++++++++++++++++++---------------- 2 files changed, 118 insertions(+), 84 deletions(-) diff --git a/package.json b/package.json index 26bb005..3c299bb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "3.0.0", + "version": "3.0.1", "beta": "true", "description": "Type definitions for APIs of Wechat Mini Program in TypeScript", "main": "./index.d.ts", diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index a2bc657..f8a98ae 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -3511,14 +3511,6 @@ innerAudioContext.onError((res) => { * - 'none': 无网络; */ networkType: 'wifi' | '2g' | '3g' | '4g' | 'unknown' | 'none' } - interface OnOnVoIPVideoMembersChangedCallbackResult { - /** 错误码 */ - errCode: number - /** 调用结果 */ - errMsg: string - /** 开启视频的成员名单 */ - openIdList: string[] - } interface OnOpenCallbackResult { /** 连接成功的 HTTP 响应 Header * @@ -3587,6 +3579,14 @@ innerAudioContext.onError((res) => { /** 还在实时语音通话中的成员 openId 名单 */ openIdList: string[] } + interface OnVoIPVideoMembersChangedCallbackResult { + /** 错误码 */ + errCode: number + /** 调用结果 */ + errMsg: string + /** 开启视频的成员名单 */ + openIdList: string[] + } interface OnWifiConnectedCallbackResult { /** [WifiInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/WifiInfo.html) * @@ -5515,6 +5515,16 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: StopWifiSuccessCallback } + interface SubscribeVoIPVideoMembersOption { + /** 订阅的成员列表 */ + openIdList: string[] + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SubscribeVoIPVideoMembersCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SubscribeVoIPVideoMembersFailCallback + /** 接口调用成功的回调函数 */ + success?: SubscribeVoIPVideoMembersSuccessCallback + } /** 订阅消息设置 */ interface SubscriptionsSetting { /** 每一项订阅消息的订阅状态。itemSettings对象的键为**一次性订阅消息的模板id**或**系统订阅消息的类型**,值为'accept'、'reject'、'ban'中的其中一种。'accept'表示用户同意订阅这条消息,'reject'表示用户拒绝订阅这条消息,'ban'表示已被后台封禁。一次性订阅消息使用方法详见 [wx.requestSubscribeMessage](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html),永久订阅消息(仅小游戏可用)使用方法详见[wx.requestSubscribeSystemMessage](/minigame/dev/api/open-api/subscribe-message/wx.requestSubscribeSystemMessage.html) */ @@ -6312,7 +6322,7 @@ innerAudioContext.onError((res) => { * 最低基础库: `2.10.3` */ offCharacteristicReadRequest( /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ - callback: OffCharacteristicReadRequestCallback + callback?: OffCharacteristicReadRequestCallback ): void /** [BLEPeripheralServer.offCharacteristicWriteRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicWriteRequest.html) * @@ -6321,7 +6331,7 @@ innerAudioContext.onError((res) => { * 最低基础库: `2.10.3` */ offCharacteristicWriteRequest( /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */ - callback: OffCharacteristicWriteRequestCallback + callback?: OffCharacteristicWriteRequestCallback ): void /** [BLEPeripheralServer.onCharacteristicReadRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicReadRequest.html) * @@ -6497,6 +6507,7 @@ innerAudioContext.onError((res) => { * | 错误码 | 错误信息 | 说明 | * | - | - | - | * | 0 | ok | 正常 | + * | -1 | already connet | 已连接 | * | 10000 | not init | 未初始化蓝牙适配器 | * | 10001 | not available | 当前蓝牙适配器不可用 | * | 10002 | no device | 没有找到指定设备 | @@ -6514,6 +6525,7 @@ innerAudioContext.onError((res) => { * | 错误码 | 错误信息 | 说明 | * | - | - | - | * | 0 | ok | 正常 | + * | -1 | already connet | 已连接 | * | 10000 | not init | 未初始化蓝牙适配器 | * | 10001 | not available | 当前蓝牙适配器不可用 | * | 10002 | no device | 没有找到指定设备 | @@ -8190,7 +8202,7 @@ ctx.draw() * 最低基础库: `2.1.0` */ offHeadersReceived( /** HTTP Response Header 事件的回调函数 */ - callback: OffHeadersReceivedCallback + callback?: OffHeadersReceivedCallback ): void /** [DownloadTask.offProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offProgressUpdate.html) * @@ -8199,7 +8211,7 @@ ctx.draw() * 最低基础库: `2.1.0` */ offProgressUpdate( /** 下载进度变化事件的回调函数 */ - callback: DownloadTaskOffProgressUpdateCallback + callback?: DownloadTaskOffProgressUpdateCallback ): void /** [DownloadTask.onHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onHeadersReceived.html) * @@ -8721,7 +8733,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offCanplay( /** 音频进入可以播放状态的事件的回调函数 */ - callback: OffCanplayCallback + callback?: OffCanplayCallback ): void /** [InnerAudioContext.offEnded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offEnded.html) * @@ -8730,7 +8742,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offEnded( /** 音频自然播放至结束的事件的回调函数 */ - callback: OffEndedCallback + callback?: OffEndedCallback ): void /** [InnerAudioContext.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offError.html) * @@ -8739,7 +8751,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offError( /** 音频播放错误事件的回调函数 */ - callback: InnerAudioContextOffErrorCallback + callback?: InnerAudioContextOffErrorCallback ): void /** [InnerAudioContext.offPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offPause.html) * @@ -8748,7 +8760,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offPause( /** 音频暂停事件的回调函数 */ - callback: OffPauseCallback + callback?: OffPauseCallback ): void /** [InnerAudioContext.offPlay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offPlay.html) * @@ -8757,7 +8769,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offPlay( /** 音频播放事件的回调函数 */ - callback: OffPlayCallback + callback?: OffPlayCallback ): void /** [InnerAudioContext.offSeeked(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offSeeked.html) * @@ -8766,7 +8778,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offSeeked( /** 音频完成跳转操作的事件的回调函数 */ - callback: OffSeekedCallback + callback?: OffSeekedCallback ): void /** [InnerAudioContext.offSeeking(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offSeeking.html) * @@ -8775,7 +8787,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offSeeking( /** 音频进行跳转操作的事件的回调函数 */ - callback: OffSeekingCallback + callback?: OffSeekingCallback ): void /** [InnerAudioContext.offStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offStop.html) * @@ -8784,7 +8796,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offStop( /** 音频停止事件的回调函数 */ - callback: OffStopCallback + callback?: OffStopCallback ): void /** [InnerAudioContext.offTimeUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offTimeUpdate.html) * @@ -8793,7 +8805,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offTimeUpdate( /** 音频播放进度更新事件的回调函数 */ - callback: OffTimeUpdateCallback + callback?: OffTimeUpdateCallback ): void /** [InnerAudioContext.offWaiting(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offWaiting.html) * @@ -8802,7 +8814,7 @@ this.editorCtx.insertImage({ * 最低基础库: `1.9.0` */ offWaiting( /** 音频加载中事件的回调函数 */ - callback: OffWaitingCallback + callback?: OffWaitingCallback ): void /** [InnerAudioContext.onCanplay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onCanplay.html) * @@ -8956,21 +8968,21 @@ Page({ * 取消监听插屏广告关闭事件 */ offClose( /** 插屏广告关闭事件的回调函数 */ - callback: UDPSocketOffCloseCallback + callback?: UDPSocketOffCloseCallback ): void /** [InterstitialAd.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offError.html) * * 取消监听插屏错误事件 */ offError( /** 插屏错误事件的回调函数 */ - callback: InterstitialAdOffErrorCallback + callback?: InterstitialAdOffErrorCallback ): void /** [InterstitialAd.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offLoad.html) * * 取消监听插屏广告加载事件 */ offLoad( /** 插屏广告加载事件的回调函数 */ - callback: OffLoadCallback + callback?: OffLoadCallback ): void /** [InterstitialAd.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onClose.html) * @@ -9305,7 +9317,7 @@ Page({ * 将地图中心移置当前定位点,此时需设置地图组件 show-location 为true。[2.8.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起支持将地图中心移动到指定位置。 * * 最低基础库: `1.2.0` */ - moveToLocation(option: MoveToLocationOption): void + moveToLocation(option?: MoveToLocationOption): void /** [MapContext.removeCustomLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeCustomLayer.html) * * 移除个性化图层。 @@ -9518,7 +9530,7 @@ Page({ * 最低基础库: `2.11.2` */ offDiscovered( /** 的回调函数 */ - callback: OffDiscoveredCallback + callback?: OffDiscoveredCallback ): void /** [NFCAdapter.onDiscovered(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.onDiscovered.html) * @@ -10215,7 +10227,7 @@ Page({ * 最低基础库: `2.1.0` */ offHeadersReceived( /** HTTP Response Header 事件的回调函数 */ - callback: OffHeadersReceivedCallback + callback?: OffHeadersReceivedCallback ): void /** [RequestTask.onHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.onHeadersReceived.html) * @@ -10247,21 +10259,21 @@ Page({ * 取消监听用户点击 `关闭广告` 按钮的事件 */ offClose( /** 用户点击 `关闭广告` 按钮的事件的回调函数 */ - callback: RewardedVideoAdOffCloseCallback + callback?: RewardedVideoAdOffCloseCallback ): void /** [RewardedVideoAd.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offError.html) * * 取消监听激励视频错误事件 */ offError( /** 激励视频错误事件的回调函数 */ - callback: RewardedVideoAdOffErrorCallback + callback?: RewardedVideoAdOffErrorCallback ): void /** [RewardedVideoAd.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offLoad.html) * * 取消监听激励视频广告加载事件 */ offLoad( /** 激励视频广告加载事件的回调函数 */ - callback: OffLoadCallback + callback?: OffLoadCallback ): void /** [RewardedVideoAd.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onClose.html) * @@ -10435,28 +10447,28 @@ Component({ * 取消监听关闭事件 */ offClose( /** 关闭事件的回调函数 */ - callback: UDPSocketOffCloseCallback + callback?: UDPSocketOffCloseCallback ): void /** [UDPSocket.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offError.html) * * 取消监听错误事件 */ offError( /** 错误事件的回调函数 */ - callback: UDPSocketOffErrorCallback + callback?: UDPSocketOffErrorCallback ): void /** [UDPSocket.offListening(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offListening.html) * * 取消监听开始监听数据包消息的事件 */ offListening( /** 开始监听数据包消息的事件的回调函数 */ - callback: OffListeningCallback + callback?: OffListeningCallback ): void /** [UDPSocket.offMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offMessage.html) * * 取消监听收到消息的事件 */ offMessage( /** 收到消息的事件的回调函数 */ - callback: OffMessageCallback + callback?: OffMessageCallback ): void /** [UDPSocket.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onClose.html) * @@ -10541,7 +10553,7 @@ Component({ * 最低基础库: `2.1.0` */ offHeadersReceived( /** HTTP Response Header 事件的回调函数 */ - callback: OffHeadersReceivedCallback + callback?: OffHeadersReceivedCallback ): void /** [UploadTask.offProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.offProgressUpdate.html) * @@ -10550,7 +10562,7 @@ Component({ * 最低基础库: `2.1.0` */ offProgressUpdate( /** 上传进度变化事件的回调函数 */ - callback: UploadTaskOffProgressUpdateCallback + callback?: UploadTaskOffProgressUpdateCallback ): void /** [UploadTask.onHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onHeadersReceived.html) * @@ -13092,7 +13104,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.1.2` */ offAppHide( /** 小程序切后台事件的回调函数 */ - callback: OffAppHideCallback + callback?: OffAppHideCallback ): void /** [wx.offAppShow(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppShow.html) * @@ -13101,7 +13113,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.1.2` */ offAppShow( /** 小程序切前台事件的回调函数 */ - callback: OffAppShowCallback + callback?: OffAppShowCallback ): void /** [wx.offAudioInterruptionBegin(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAudioInterruptionBegin.html) * @@ -13110,7 +13122,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.6.2` */ offAudioInterruptionBegin( /** 音频因为受到系统占用而被中断开始事件的回调函数 */ - callback: OffAudioInterruptionBeginCallback + callback?: OffAudioInterruptionBeginCallback ): void /** [wx.offAudioInterruptionEnd(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAudioInterruptionEnd.html) * @@ -13119,7 +13131,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.6.2` */ offAudioInterruptionEnd( /** 音频中断结束事件的回调函数 */ - callback: OffAudioInterruptionEndCallback + callback?: OffAudioInterruptionEndCallback ): void /** [wx.offBLECharacteristicValueChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.offBLECharacteristicValueChange.html) * @@ -13146,7 +13158,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.10.3` */ offBLEPeripheralConnectionStateChanged( /** 当前外围设备被连接或断开连接事件的回调函数 */ - callback: OffBLEPeripheralConnectionStateChangedCallback + callback?: OffBLEPeripheralConnectionStateChangedCallback ): void /** [wx.offBeaconServiceChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconServiceChange.html) * @@ -13155,7 +13167,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.8.1` */ offBeaconServiceChange( /** iBeacon 服务状态变化事件的回调函数 */ - callback: OffBeaconServiceChangeCallback + callback?: OffBeaconServiceChangeCallback ): void /** [wx.offBeaconUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconUpdate.html) * @@ -13164,7 +13176,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.8.1` */ offBeaconUpdate( /** iBeacon 设备更新事件的回调函数 */ - callback: OffBeaconUpdateCallback + callback?: OffBeaconUpdateCallback ): void /** [wx.offBluetoothAdapterStateChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothAdapterStateChange.html) * @@ -13254,7 +13266,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.4.0` */ offLocalServiceDiscoveryStop( /** mDNS 服务停止搜索的事件的回调函数 */ - callback: OffLocalServiceDiscoveryStopCallback + callback?: OffLocalServiceDiscoveryStopCallback ): void /** [wx.offLocalServiceFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceFound.html) * @@ -13263,7 +13275,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.4.0` */ offLocalServiceFound( /** mDNS 服务发现的事件的回调函数 */ - callback: OffLocalServiceFoundCallback + callback?: OffLocalServiceFoundCallback ): void /** [wx.offLocalServiceLost(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceLost.html) * @@ -13272,7 +13284,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.4.0` */ offLocalServiceLost( /** mDNS 服务离开的事件的回调函数 */ - callback: OffLocalServiceLostCallback + callback?: OffLocalServiceLostCallback ): void /** [wx.offLocalServiceResolveFail(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceResolveFail.html) * @@ -13281,7 +13293,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.4.0` */ offLocalServiceResolveFail( /** mDNS 服务解析失败的事件的回调函数 */ - callback: OffLocalServiceResolveFailCallback + callback?: OffLocalServiceResolveFailCallback ): void /** [wx.offLocationChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.offLocationChange.html) * @@ -13290,7 +13302,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.8.1` */ offLocationChange( /** 实时地理位置变化事件的回调函数 */ - callback: OffLocationChangeCallback + callback?: OffLocationChangeCallback ): void /** [wx.offMemoryWarning(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/performance/wx.offMemoryWarning.html) * @@ -13310,15 +13322,6 @@ wx.notifyBLECharacteristicValueChange({ /** 网络状态变化事件的回调函数 */ callback: (...args: any[]) => any ): void - /** [wx.offOnVoIPVideoMembersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offOnVoIPVideoMembersChanged.html) - * - * 取消监听实时语音通话成员视频状态变化事件 - * - * 最低基础库: `2.11.0` */ - offOnVoIPVideoMembersChanged( - /** 实时语音通话成员视频状态变化事件的回调函数 */ - callback: OffOnVoIPVideoMembersChangedCallback - ): void /** [wx.offPageNotFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offPageNotFound.html) * * 取消监听小程序要打开的页面不存在事件 @@ -13326,7 +13329,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.1.2` */ offPageNotFound( /** 小程序要打开的页面不存在事件的回调函数 */ - callback: OffPageNotFoundCallback + callback?: OffPageNotFoundCallback ): void /** [wx.offThemeChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offThemeChange.html) * @@ -13335,7 +13338,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.11.0` */ offThemeChange( /** 系统主题改变事件的回调函数 */ - callback: OffThemeChangeCallback + callback?: OffThemeChangeCallback ): void /** [wx.offUnhandledRejection(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offUnhandledRejection.html) * @@ -13344,7 +13347,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.10.0` */ offUnhandledRejection( /** 未处理的 Promise 拒绝事件的回调函数 */ - callback: OffUnhandledRejectionCallback + callback?: OffUnhandledRejectionCallback ): void /** [wx.offUserCaptureScreen(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offUserCaptureScreen.html) * @@ -13373,6 +13376,15 @@ wx.notifyBLECharacteristicValueChange({ /** 实时语音通话成员在线状态变化事件的回调函数 */ callback: (...args: any[]) => any ): void + /** [wx.offVoIPVideoMembersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPVideoMembersChanged.html) + * + * 取消监听实时语音通话成员视频状态变化事件 + * + * 最低基础库: `2.11.0` */ + offVoIPVideoMembersChanged( + /** 实时语音通话成员视频状态变化事件的回调函数 */ + callback?: OffVoIPVideoMembersChangedCallback + ): void /** [wx.offWifiConnected(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offWifiConnected.html) * * 取消监听连接上 Wi-Fi 的事件。 @@ -13389,7 +13401,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.3.0` */ offWindowResize( /** 窗口尺寸变化事件的回调函数 */ - callback: OffWindowResizeCallback + callback?: OffWindowResizeCallback ): void /** [wx.onAccelerometerChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.onAccelerometerChange.html) * @@ -13807,15 +13819,6 @@ wx.onNetworkStatusChange(function (res) { /** 网络状态变化事件的回调函数 */ callback: OnNetworkStatusChangeCallback ): void - /** [wx.onOnVoIPVideoMembersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onOnVoIPVideoMembersChanged.html) - * - * 监听实时语音通话成员视频状态变化事件。 - * - * 最低基础库: `2.11.0` */ - onOnVoIPVideoMembersChanged( - /** 实时语音通话成员视频状态变化事件的回调函数 */ - callback: OnOnVoIPVideoMembersChangedCallback - ): void /** [wx.onPageNotFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onPageNotFound.html) * * 监听小程序要打开的页面不存在事件。该事件与 [`App.onPageNotFound`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onpagenotfoundobject-object) 的回调时机一致。 @@ -13934,6 +13937,15 @@ wx.onUserCaptureScreen(function (res) { /** 实时语音通话成员通话状态变化事件的回调函数 */ callback: OnVoIPChatSpeakersChangedCallback ): void + /** [wx.onVoIPVideoMembersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPVideoMembersChanged.html) + * + * 监听实时语音通话成员视频状态变化事件。 + * + * 最低基础库: `2.11.0` */ + onVoIPVideoMembersChanged( + /** 实时语音通话成员视频状态变化事件的回调函数 */ + callback: OnVoIPVideoMembersChangedCallback + ): void /** [wx.onWifiConnected(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onWifiConnected.html) * * 监听连接上 Wi-Fi 的事件 @@ -13987,7 +13999,7 @@ wx.openBluetoothAdapter({ * * 最低基础库: `1.1.0` */ openBluetoothAdapter( - option: TOption + option?: TOption ): PromisifySuccessResult /** [wx.openCard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/card/wx.openCard.html) * @@ -15176,7 +15188,7 @@ wx.startAccelerometer({ * * 最低基础库: `1.1.0` */ startAccelerometer( - option: TOption + option?: TOption ): PromisifySuccessResult /** [wx.startBeaconDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.startBeaconDiscovery.html) * @@ -15243,7 +15255,7 @@ wx.startCompass() startDeviceMotionListening< TOption extends StartDeviceMotionListeningOption >( - option: TOption + option?: TOption ): PromisifySuccessResult /** [wx.startGyroscope(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.startGyroscope.html) * @@ -15251,7 +15263,7 @@ wx.startCompass() * * 最低基础库: `2.3.0` */ startGyroscope( - option: TOption + option?: TOption ): PromisifySuccessResult /** [wx.startHCE(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.startHCE.html) * @@ -15636,6 +15648,16 @@ wx.stopWifi({ stopWifi( option?: TOption ): PromisifySuccessResult + /** [wx.subscribeVoIPVideoMembers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.subscribeVoIPVideoMembers.html) + * + * 订阅视频画面成员。对于视频房间,当成员超过两人时需进行订阅,否则只能看到最先加入房间的两人画面。 + * + * 最低基础库: `2.11.0` */ + subscribeVoIPVideoMembers< + TOption extends SubscribeVoIPVideoMembersOption + >( + option: TOption + ): PromisifySuccessResult /** [wx.switchTab(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.switchTab.html) * * 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面 @@ -16797,10 +16819,6 @@ wx.writeBLECharacteristicValue({ ) => void /** 收到消息的事件的回调函数 */ type OffMessageCallback = (result: UDPSocketOnMessageCallbackResult) => void - /** 实时语音通话成员视频状态变化事件的回调函数 */ - type OffOnVoIPVideoMembersChangedCallback = ( - result: OnOnVoIPVideoMembersChangedCallbackResult - ) => void /** 小程序要打开的页面不存在事件的回调函数 */ type OffPageNotFoundCallback = ( result: OnPageNotFoundCallbackResult @@ -16823,6 +16841,10 @@ wx.writeBLECharacteristicValue({ type OffUnhandledRejectionCallback = ( result: OnUnhandledRejectionCallbackResult ) => void + /** 实时语音通话成员视频状态变化事件的回调函数 */ + type OffVoIPVideoMembersChangedCallback = ( + result: OnVoIPVideoMembersChangedCallbackResult + ) => void /** 音频加载中事件的回调函数 */ type OffWaitingCallback = (res: GeneralCallbackResult) => void /** 窗口尺寸变化事件的回调函数 */ @@ -16964,10 +16986,6 @@ wx.writeBLECharacteristicValue({ ) => void /** 用户在系统音乐播放面板点击下一曲事件的回调函数 */ type OnNextCallback = (res: GeneralCallbackResult) => void - /** 实时语音通话成员视频状态变化事件的回调函数 */ - type OnOnVoIPVideoMembersChangedCallback = ( - result: OnOnVoIPVideoMembersChangedCallbackResult - ) => void /** WebSocket 连接打开事件的回调函数 */ type OnOpenCallback = (result: OnOpenCallbackResult) => void /** 小程序要打开的页面不存在事件的回调函数 */ @@ -17021,6 +17039,10 @@ wx.writeBLECharacteristicValue({ type OnVoIPChatSpeakersChangedCallback = ( result: OnVoIPChatSpeakersChangedCallbackResult ) => void + /** 实时语音通话成员视频状态变化事件的回调函数 */ + type OnVoIPVideoMembersChangedCallback = ( + result: OnVoIPVideoMembersChangedCallbackResult + ) => void /** 音频加载中事件的回调函数 */ type OnWaitingCallback = (res: GeneralCallbackResult) => void /** 连接上 Wi-Fi 的事件的回调函数 */ @@ -17918,6 +17940,18 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type StopWifiSuccessCallback = (res: WifiError) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type SubscribeVoIPVideoMembersCompleteCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用失败的回调函数 */ + type SubscribeVoIPVideoMembersFailCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用成功的回调函数 */ + type SubscribeVoIPVideoMembersSuccessCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SwitchCameraCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type SwitchCameraFailCallback = (res: GeneralCallbackResult) => void From 89af83366905fbb14a5f08b963cc9467cd2bddee Mon Sep 17 00:00:00 2001 From: "Mr.Hope" Date: Mon, 17 Aug 2020 12:25:10 +0800 Subject: [PATCH 029/205] fix: animate api issue --- types/wx/lib.wx.component.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/wx/lib.wx.component.d.ts b/types/wx/lib.wx.component.d.ts index 2a4e18f..f5a9bce 100644 --- a/types/wx/lib.wx.component.d.ts +++ b/types/wx/lib.wx.component.d.ts @@ -236,7 +236,7 @@ declare namespace WechatMiniprogram { selector: string, keyFrames: KeyFrame[], duration: number, - callback: () => void + callback?: () => void ): void /** * 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) @@ -262,8 +262,8 @@ declare namespace WechatMiniprogram { **/ clearAnimation( selector: string, - options: ClearAnimationOptions, - callback: () => void + options?: ClearAnimationOptions, + callback?: () => void ): void getOpenerEventChannel(): EventChannel } From cc0d4df5116e72f47f83db333947ef9d15dc20c8 Mon Sep 17 00:00:00 2001 From: SgLy <775150558@qq.com> Date: Wed, 19 Aug 2020 15:35:02 +0800 Subject: [PATCH 030/205] feat: regular bug fix and update --- package-lock.json | 2 +- package.json | 2 +- types/wx/lib.wx.api.d.ts | 172 ++++++++++++++++++++++++++------------ types/wx/lib.wx.page.d.ts | 20 ++--- 4 files changed, 131 insertions(+), 65 deletions(-) diff --git a/package-lock.json b/package-lock.json index f28c679..77276f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "3.0.0", + "version": "3.0.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 3c299bb..392bf6e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "3.0.1", + "version": "3.0.2", "beta": "true", "description": "Type definitions for APIs of Wechat Mini Program in TypeScript", "main": "./index.d.ts", diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index 89609bf..ff2f72e 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -78,16 +78,6 @@ declare namespace WechatMiniprogram { cardList: AddCardResponseInfo[] errMsg: string } - interface AddCustomLayerOption { - /** 个性化图层id */ - layerId: string - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: AddCustomLayerCompleteCallback - /** 接口调用失败的回调函数 */ - fail?: AddCustomLayerFailCallback - /** 接口调用成功的回调函数 */ - success?: AddCustomLayerSuccessCallback - } interface AddPhoneContactOption { /** 名字 */ firstName: string @@ -181,6 +171,10 @@ declare namespace WechatMiniprogram { /** 要广播的serviceUuid列表 */ serviceUuids?: string[] } + /** animationData */ + interface AnimationExportResult { + actions: IAnyObject[] + } /** 动画效果 */ interface AnimationOption { /** 动画变化时间,单位 ms */ @@ -2312,7 +2306,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb * * 最低基础库: `2.6.0` */ albumAuthorized: boolean - /** 设备性能等级(仅Android小游戏)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) + /** 设备性能等级(仅 Android)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) * * 最低基础库: `1.8.0` */ benchmarkLevel: number @@ -2415,7 +2409,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb * * 最低基础库: `2.6.0` */ albumAuthorized: boolean - /** 设备性能等级(仅Android小游戏)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) + /** 设备性能等级(仅 Android)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) * * 最低基础库: `1.8.0` */ benchmarkLevel: number @@ -2908,6 +2902,34 @@ innerAudioContext.onError((res) => { /** 错误信息 */ errMsg: string } + interface Join1v1ChatOption { + /** 呼叫方信息 */ + caller: VoIP1v1ChatUser + /** 接听方信息 */ + listener: VoIP1v1ChatUser + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: Join1v1ChatCompleteCallback + /** 不允许切换到语音通话 */ + disableSwitchVoice?: boolean + /** 接口调用失败的回调函数 */ + fail?: Join1v1ChatFailCallback + /** 忽略自身版本不支持的情况 */ + ignoreSelfVersion?: boolean + /** 忽略对方版本不支持的情况 */ + ignoreTargetVersion?: boolean + /** 小窗样式 */ + minWindowType?: number + /** 静音设置 */ + muteConfig?: MuteConfig + /** 通话类型 + * + * 可选值: + * - 'voice': 语音通话; + * - 'video': 视频通话; */ + roomType?: 'voice' | 'video' + /** 接口调用成功的回调函数 */ + success?: Join1v1ChatSuccessCallback + } interface JoinVoIPChatOption { /** 小游戏内此房间/群聊的 ID。同一时刻传入相同 groupId 的用户会进入到同个实时语音房间。 */ groupId: string @@ -4089,16 +4111,6 @@ innerAudioContext.onError((res) => { /** message 的大小,单位:字节 */ size: number } - interface RemoveCustomLayerOption { - /** 个性化图层id */ - layerId: string - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: RemoveCustomLayerCompleteCallback - /** 接口调用失败的回调函数 */ - fail?: RemoveCustomLayerFailCallback - /** 接口调用成功的回调函数 */ - success?: RemoveCustomLayerSuccessCallback - } interface RemoveFormatOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: RemoveFormatCompleteCallback @@ -4690,6 +4702,20 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: SetContentsSuccessCallback } + interface SetEnable1v1ChatOption { + /** 是否开启 */ + enable: boolean + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetEnable1v1ChatCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetEnable1v1ChatFailCallback + /** 忽略自身版本不支持的情况 */ + ignoreSelfVersion?: boolean + /** 小窗样式 */ + minWindowType?: number + /** 接口调用成功的回调函数 */ + success?: SetEnable1v1ChatSuccessCallback + } interface SetEnableDebugOption { /** 是否打开调试 */ enableDebug: boolean @@ -5859,6 +5885,14 @@ innerAudioContext.onError((res) => { /** 解码模式。0:按 pts 解码;1:以最快速度解码 */ mode?: number } + interface VoIP1v1ChatUser { + /** 昵称 */ + nickname: string + /** 小程序内 openid */ + openid: string + /** 头像 */ + headImage?: string + } /** 提供预设的 Wi-Fi 信息列表 */ interface WifiData { /** Wi-Fi 的 BSSID */ @@ -6059,12 +6093,10 @@ innerAudioContext.onError((res) => { USER_DATA_PATH: string } interface Animation { - /** [Array.<Object> Animation.export()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.export.html) + /** [Object Animation.export()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.export.html) * * 导出动画队列。**export 方法每次调用后会清掉之前的动画操作。** */ - export(): { - actions: IAnyObject[] - } + export(): AnimationExportResult /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.backgroundColor(string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.backgroundColor.html) * * 设置背景色 */ @@ -9087,6 +9119,42 @@ Page({ * 最低基础库: `2.11.2` */ transceive(option: TransceiveOption): void } + interface Join1v1ChatError { + /** 错误信息 + * + * | 错误码 | 错误信息 | 说明 | + * | - | - | - | + * | -20000 | not open 1v1 Chat | 未开通双人通话 | + * | -20001 | device not support | 当前设备不支持 | + * | -20002 | on call | 正在通话中 | + * | -20003 | occupied by other miniprogram | 其它小程序正在通话中 | + * | -30000 | system error | 内部系统错误 | + * | -30001 | wechat has no camera authorization | 微信缺失相机权限 | + * | -30002 | wechat has no record authorization | 微信缺失录音权限 | + * | -30003 | miniprogram has no camera authorization | 小程序缺失相机权限 | + * | -30004 | miniprogram has no record authorization | 小程序缺失录音权限 | + * | -1 | | 当前已在房间内 | + * | -2 | | 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 | + * | -3 | | 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 | + * | -1000 | | 系统错误 | */ errMsg: string + /** 错误码 + * + * | 错误码 | 错误信息 | 说明 | + * | - | - | - | + * | -20000 | not open 1v1 Chat | 未开通双人通话 | + * | -20001 | device not support | 当前设备不支持 | + * | -20002 | on call | 正在通话中 | + * | -20003 | occupied by other miniprogram | 其它小程序正在通话中 | + * | -30000 | system error | 内部系统错误 | + * | -30001 | wechat has no camera authorization | 微信缺失相机权限 | + * | -30002 | wechat has no record authorization | 微信缺失录音权限 | + * | -30003 | miniprogram has no camera authorization | 小程序缺失相机权限 | + * | -30004 | miniprogram has no record authorization | 小程序缺失录音权限 | + * | -1 | | 当前已在房间内 | + * | -2 | | 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 | + * | -3 | | 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 | + * | -1000 | | 系统错误 | */ errCode: number + } interface JoinVoIPChatError { /** 错误信息 * @@ -9274,12 +9342,6 @@ Page({ ): void } interface MapContext { - /** [MapContext.addCustomLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addCustomLayer.html) - * - * 添加个性化图层。 - * - * 最低基础库: `2.12.0` */ - addCustomLayer(option: AddCustomLayerOption): void /** [MapContext.getCenterLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getCenterLocation.html) * * 获取当前地图中心的经纬度。返回的是 gcj02 坐标系,可以用于 [wx.openLocation()](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.openLocation.html) */ @@ -9320,12 +9382,6 @@ Page({ * * 最低基础库: `1.2.0` */ moveToLocation(option?: MoveToLocationOption): void - /** [MapContext.removeCustomLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeCustomLayer.html) - * - * 移除个性化图层。 - * - * 最低基础库: `2.12.0` */ - removeCustomLayer(option: RemoveCustomLayerOption): void /** [MapContext.setCenterOffset(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setCenterOffset.html) * * 设置地图中心点偏移,向后向下为增长,屏幕比例范围(0.25~0.75),默认偏移为[0.5, 0.5] @@ -12812,6 +12868,12 @@ wx.hideShareMenu({ hideToast( option?: TOption ): PromisifySuccessResult + /** [wx.join1v1Chat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.join1v1Chat.html) + * + * 加入(创建)双人通话。使用前需先调用 [wx.setEnable1v1Chat](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.setEnable1v1Chat.html) 开启双人通话。 + * + * 最低基础库: `2.12.1` */ + join1v1Chat(option: Join1v1ChatOption): void /** [wx.joinVoIPChat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.joinVoIPChat.html) * * 加入 (创建) 实时语音通话,更多信息可见 [实时语音指南](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/voip-chat.html) @@ -13358,7 +13420,7 @@ wx.notifyBLECharacteristicValueChange({ * 最低基础库: `2.9.3` */ offUserCaptureScreen( /** 用户主动截屏事件的回调函数 */ - callback: (...args: any[]) => any + callback?: (...args: any[]) => any ): void /** [wx.offVoIPChatInterrupted(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatInterrupted.html) * @@ -14756,6 +14818,12 @@ wx.setClipboardData({ setClipboardData( option: TOption ): PromisifySuccessResult + /** [wx.setEnable1v1Chat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.setEnable1v1Chat.html) + * + * 开启双人通话。设置 `enable` 为 `false` 时,无法拨打和接听呼叫。 + * + * 最低基础库: `2.12.1` */ + setEnable1v1Chat(option: SetEnable1v1ChatOption): void /** [wx.setEnableDebug(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html) * * 设置是否打开调试开关。此开关对正式版也能生效。 @@ -15808,12 +15876,6 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type AddCardSuccessCallback = (result: AddCardSuccessCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type AddCustomLayerCompleteCallback = (res: GeneralCallbackResult) => void - /** 接口调用失败的回调函数 */ - type AddCustomLayerFailCallback = (res: GeneralCallbackResult) => void - /** 接口调用成功的回调函数 */ - type AddCustomLayerSuccessCallback = (res: GeneralCallbackResult) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type AddPhoneContactCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type AddPhoneContactFailCallback = (res: GeneralCallbackResult) => void @@ -16647,6 +16709,12 @@ wx.writeBLECharacteristicValue({ result: InterstitialAdOnErrorCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type Join1v1ChatCompleteCallback = (res: Join1v1ChatError) => void + /** 接口调用失败的回调函数 */ + type Join1v1ChatFailCallback = (res: Join1v1ChatError) => void + /** 接口调用成功的回调函数 */ + type Join1v1ChatSuccessCallback = (res: Join1v1ChatError) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type JoinVoIPChatCompleteCallback = (res: JoinVoIPChatError) => void /** 接口调用失败的回调函数 */ type JoinVoIPChatFailCallback = (res: JoinVoIPChatError) => void @@ -17212,14 +17280,6 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type RedoSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type RemoveCustomLayerCompleteCallback = ( - res: GeneralCallbackResult - ) => void - /** 接口调用失败的回调函数 */ - type RemoveCustomLayerFailCallback = (res: GeneralCallbackResult) => void - /** 接口调用成功的回调函数 */ - type RemoveCustomLayerSuccessCallback = (res: GeneralCallbackResult) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type RemoveFormatCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type RemoveFormatFailCallback = (res: GeneralCallbackResult) => void @@ -17458,6 +17518,12 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type SetContentsSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type SetEnable1v1ChatCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type SetEnable1v1ChatFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type SetEnable1v1ChatSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SetEnableDebugCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type SetEnableDebugFailCallback = (res: GeneralCallbackResult) => void diff --git a/types/wx/lib.wx.page.d.ts b/types/wx/lib.wx.page.d.ts index 40ecd8b..74cb46f 100644 --- a/types/wx/lib.wx.page.d.ts +++ b/types/wx/lib.wx.page.d.ts @@ -49,12 +49,12 @@ declare namespace WechatMiniprogram { onLoad( /** 打开当前页面路径中的参数 */ query: Record - ): void + ): void | Promise /** 生命周期回调—监听页面显示 * * 页面显示/切入前台时触发。 */ - onShow(): void + onShow(): void | Promise /** 生命周期回调—监听页面初次渲染完成 * * 页面初次渲染完成时触发。一个页面只会调用一次,代表页面已经准备妥当,可以和视图层进行交互。 @@ -62,17 +62,17 @@ declare namespace WechatMiniprogram { * 注意:对界面内容进行设置的 API 如`wx.setNavigationBarTitle`,请在`onReady`之后进行。 */ - onReady(): void + onReady(): void | Promise /** 生命周期回调—监听页面隐藏 * * 页面隐藏/切入后台时触发。 如 `navigateTo` 或底部 `tab` 切换到其他页面,小程序切入后台等。 */ - onHide(): void + onHide(): void | Promise /** 生命周期回调—监听页面卸载 * * 页面卸载时触发。如`redirectTo`或`navigateBack`到其他页面时。 */ - onUnload(): void + onUnload(): void | Promise /** 监听用户下拉动作 * * 监听用户下拉刷新事件。 @@ -80,14 +80,14 @@ declare namespace WechatMiniprogram { * - 可以通过`wx.startPullDownRefresh`触发下拉刷新,调用后触发下拉刷新动画,效果与用户手动下拉刷新一致。 * - 当处理完数据刷新后,`wx.stopPullDownRefresh`可以停止当前页面的下拉刷新。 */ - onPullDownRefresh(): void + onPullDownRefresh(): void | Promise /** 页面上拉触底事件的处理函数 * * 监听用户上拉触底事件。 * - 可以在`app.json`的`window`选项中或页面配置中设置触发距离`onReachBottomDistance`。 * - 在触发距离内滑动期间,本事件只会被触发一次。 */ - onReachBottom(): void + onReachBottom(): void | Promise /** 用户点击右上角转发 * * 监听用户点击页面内转发按钮(` +* +* +* +* +* {{userInfo.nickName}} +* +* +* +* ``` +* +* ```js +Page({ + data: { + userInfo: {}, + hasUserInfo: false, + canIUseGetUserProfile: false, + }, + onLoad() { + if (wx.getUserProfile) { + this.setData({ + canIUseGetUserProfile: true + }) + } + }, + getUserProfile(e) { + // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认 + // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 + wx.getUserProfile({ + desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 + success: (res) => { + this.setData({ + userInfo: res.userInfo, + hasUserInfo: true + }) + } + }) + }, + getUserInfo(e) { + // 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息 + this.setData({ + userInfo: e.detail.userInfo, + hasUserInfo: true + }) + }, +}) +``` +* +* 最低基础库: `2.10.4` */ getUserProfile( option: T ): PromisifySuccessResult @@ -13906,7 +14204,7 @@ wx.loadFontFace({ ): PromisifySuccessResult /** [wx.login(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html) * -* 调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户的唯一标识(openid)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。 +* 调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户在当前小程序的唯一标识(openid)、微信开放平台帐号下的唯一标识(unionid,若当前小程序已绑定到微信开放平台帐号)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。 * * **示例代码** * @@ -15504,14 +15802,16 @@ wx.reportAnalytics('purchase', { /** 上报的自定义数据,key 为配置中的字段名,value 为上报的数据。 */ data: IAnyObject ): void - /** [wx.reportEvent(string eventId)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/report/wx.reportEvent.html) + /** [wx.reportEvent(string eventId, object data)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/report/wx.reportEvent.html) * * 事件上报 * * 最低基础库: `2.14.4` */ reportEvent( /** 在 mp 实验系统中设置的事件英文名 */ - eventId: string + eventId: string, + /** 可被 JSON.stringily 的对象,将一起上报至系统 */ + data?: IAnyObject ): void /** [wx.reportMonitor(string name, number value)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/report/wx.reportMonitor.html) * @@ -15557,6 +15857,19 @@ wx.reportPerformance(1101, 680, 'custom') /** 自定义维度 (选填) */ dimensions?: string | any[] ): void + /** [wx.requestOrderPayment(Object args)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/payment/wx.requestOrderPayment.html) + * + * 创建自定义版交易组件订单,并发起支付。 + * 接入自定义版交易组件之后,若要发起微信支付,请先查询[需要校验的场景](https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent2/API/order/check_scene.html)。 + * 在需要校验的场景中,发起微信支付时,必须使用该接口,需要按照要求传入相关的[订单信息](https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent2/API/order/add_order.html)进行校验,校验通过后用户才可以完成当前订单的支付,非需要校验的场景则可以按照商家要求自行选择传入订单信息或不传入。 + * 除订单信息以外,具体使用方式与[wx.requestPayment](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/payment/wx.requestPayment.html)相同。 + * + * 最低基础库: `2.16.0` */ + requestOrderPayment< + T extends RequestOrderPaymentOption = RequestOrderPaymentOption + >( + args: T + ): PromisifySuccessResult /** [wx.requestPayment(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/payment/wx.requestPayment.html) * * 发起微信支付。调用前需在[小程序微信公众平台](https://mp.weixin.qq.com/) -功能-微信支付入口申请接入微信支付。了解更多信息,可以参考 [微信支付开发文档](https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/api.shtml): @@ -16221,6 +16534,12 @@ wx.getWifiList() * @deprecated 基础库版本 [2.11.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃 * */ setWindowSize(option: SetWindowSizeOption): void + /** [wx.shareToWeRun(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.shareToWeRun.html) + * + * 分享数据到微信运动。 */ + shareToWeRun( + option: T + ): PromisifySuccessResult /** [wx.showActionSheet(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showActionSheet.html) * * 显示操作菜单 @@ -17051,6 +17370,10 @@ wx.writeBLECharacteristicValue({ >( option: T ): PromisifySuccessResult + /** 小程序云开发 */ + cloud: WxCloud + /** 文件系统中的用户目录路径 */ + env: { USER_DATA_PATH: string } } /** 接口调用结束的回调函数(调用成功、失败都会执行) */ @@ -17250,6 +17573,14 @@ wx.writeBLECharacteristicValue({ result: ChooseAddressSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type ChooseContactCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type ChooseContactFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type ChooseContactSuccessCallback = ( + option: ChooseContactSuccessCallbackOption + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ChooseImageCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type ChooseImageFailCallback = (res: GeneralCallbackResult) => void @@ -17302,6 +17633,14 @@ wx.writeBLECharacteristicValue({ result: ChooseMessageFileSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type ChoosePoiCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type ChoosePoiFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type ChoosePoiSuccessCallback = ( + result: ChoosePoiSuccessCallbackResult + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ChooseVideoCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type ChooseVideoFailCallback = (res: GeneralCallbackResult) => void @@ -17998,6 +18337,8 @@ wx.writeBLECharacteristicValue({ type InterstitialAdOffErrorCallback = ( result: InterstitialAdOnErrorCallbackResult ) => void + /** 插屏广告关闭事件的回调函数 */ + type InterstitialAdOnCloseCallback = (res: GeneralCallbackResult) => void /** 插屏错误事件的回调函数 */ type InterstitialAdOnErrorCallback = ( result: InterstitialAdOnErrorCallbackResult @@ -18398,7 +18739,7 @@ wx.writeBLECharacteristicValue({ type OnPlayCallback = (res: GeneralCallbackResult) => void /** 用户在系统音乐播放面板点击上一曲事件的回调函数 */ type OnPrevCallback = (res: GeneralCallbackResult) => void - /** worker进程被系统回收事件的回调函数 */ + /** worker线程被系统回收事件的回调函数 */ type OnProcessKilledCallback = (res: GeneralCallbackResult) => void /** 录音继续事件的回调函数 */ type OnResumeCallback = (res: GeneralCallbackResult) => void @@ -18694,6 +19035,16 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type RequestFullScreenSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type RequestOrderPaymentCompleteCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用失败的回调函数 */ + type RequestOrderPaymentFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type RequestOrderPaymentSuccessCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type RequestPaymentCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type RequestPaymentFailCallback = (res: GeneralCallbackResult) => void @@ -18933,6 +19284,12 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type SetKeepScreenOnSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type SetLocMarkerIconCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type SetLocMarkerIconFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type SetLocMarkerIconSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type SetMICVolumeCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type SetMICVolumeFailCallback = (res: GeneralCallbackResult) => void @@ -19027,6 +19384,12 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type SetZoomSuccessCallback = (result: SetZoomSuccessCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type ShareToWeRunCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type ShareToWeRunFailCallback = (res: GeneralCallbackResult) => void + /** 接口调用成功的回调函数 */ + type ShareToWeRunSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ShowActionSheetCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type ShowActionSheetFailCallback = (res: GeneralCallbackResult) => void @@ -19485,6 +19848,7 @@ wx.writeBLECharacteristicValue({ type UDPSocketOffErrorCallback = ( result: UDPSocketOnErrorCallbackResult ) => void + /** 关闭事件的回调函数 */ type UDPSocketOnCloseCallback = (res: GeneralCallbackResult) => void type UDPSocketOnErrorCallback = ( result: UDPSocketOnErrorCallbackResult From 15ac1fcb58a1eab0dbe311ee2166d5118a83c464 Mon Sep 17 00:00:00 2001 From: SgLy <775150558@qq.com> Date: Wed, 21 Apr 2021 23:33:55 +0800 Subject: [PATCH 058/205] feat: update to baselib 2.16.1 --- CHANGELOG.md | 3 + package-lock.json | 2 +- package.json | 2 +- test/api-doc.test.ts | 293 +++++++++- types/wx/lib.wx.api.d.ts | 1127 ++++++++++++++++++++++++++++++++++--- types/wx/lib.wx.page.d.ts | 6 +- 6 files changed, 1330 insertions(+), 103 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 000d05a..d57f42f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2021-04-21 v3.3.2 +- 更新 API 定义到 2.16.1 + ## 2021-04-09 v3.3.1 - 更新 API 定义到 2.16.0 diff --git a/package-lock.json b/package-lock.json index 291de84..527096c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "3.3.1", + "version": "3.3.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index da1d804..e4ca027 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miniprogram-api-typings", - "version": "3.3.1", + "version": "3.3.2", "beta": "true", "description": "Type definitions for APIs of Wechat Mini Program in TypeScript", "main": "./index.d.ts", diff --git a/test/api-doc.test.ts b/test/api-doc.test.ts index fdfdd7c..6b5cfef 100644 --- a/test/api-doc.test.ts +++ b/test/api-doc.test.ts @@ -455,8 +455,12 @@ import { expectType } from 'tsd' { const worker = wx.createWorker('workers/request/index.js') // 文件名指定 worker 的入口文件路径,绝对路径 - worker.onMessage(function(res) { - expectType>(res.message) + worker.onMessage(function (res) { + expectType(res) + }) + // 监听worker被系统回收事件 + worker.onProcessKilled(function () { + console.log('worker has been killed') }) worker.postMessage({ @@ -906,10 +910,22 @@ import { expectType } from 'tsd' // Test case from `wx.getRealtimeLogManager` { - const logger = wx.getRealtimeLogManager() - logger.info({ str: 'hello world' }, 'info log', 100, [1, 2, 3]) - logger.error({ str: 'hello world' }, 'error log', 100, [1, 2, 3]) - logger.warn({ str: 'hello world' }, 'warn log', 100, [1, 2, 3]) + // 小程序端 + { + const logger = wx.getRealtimeLogManager() + logger.info({ str: 'hello world' }, 'info log', 100, [1, 2, 3]) + logger.error({ str: 'hello world' }, 'error log', 100, [1, 2, 3]) + logger.warn({ str: 'hello world' }, 'warn log', 100, [1, 2, 3]) + } + + // 插件端,基础库 2.16.0 版本后支持,只允许采用 key-value 的新格式上报 + { + const logManager = wx.getRealtimeLogManager() + const logger = logManager.tag('plugin-log1') + logger.info('key1', 'value1') + logger.error('key2', { str: 'value2' }) + logger.warn('key3', 'value3') + } } // Test case from `wx.getSavedFileInfo` @@ -2059,9 +2075,17 @@ import { expectType } from 'tsd' // Test case from `wx.createWorker` { // 创建实验worker - wx.createWorker('workers/index.js', { + const worker = wx.createWorker('workers/index.js', { useExperimentalWorker: true, }) + + // 监听worker被系统回收事件 + worker.onProcessKilled(() => { + // 重新创建一个worker + wx.createWorker('workers/index.js', { + useExperimentalWorker: true, + }) + }) } // Test case from `wx.clearStorageSync` @@ -3245,3 +3269,258 @@ import { expectType } from 'tsd' mediaAudioPlayer.volume = 0.5 }) } + +// Test case from `ScrollViewContext` +{ + wx.createSelectorQuery() + .select('#scrollview') + .node() + .exec(res => { + const scrollView = res[0].node + scrollView.scrollEnabled = false + }) +} + +// Test case from `wx.getUserProfile` +{ + Page({ + data: { + userInfo: {}, + hasUserInfo: false, + canIUseGetUserProfile: false, + }, + onLoad() { + if (wx.getUserProfile !== undefined) { + this.setData({ + canIUseGetUserProfile: true, + }) + } + }, + getUserProfile() { + // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认 + // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 + wx.getUserProfile({ + desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 + success: res => { + this.setData({ + userInfo: res.userInfo, + hasUserInfo: true, + }) + }, + }) + }, + getUserInfo(e: WechatMiniprogram.CustomEvent<{ userInfo: WechatMiniprogram.UserInfo }>) { + // 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息 + this.setData({ + userInfo: e.detail.userInfo, + hasUserInfo: true, + }) + }, + }) +} + +// Test case from `FileSystemManager.close` +{ + const fs = wx.getFileSystemManager() + // 打开文件 + fs.open({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + success(res) { + // 关闭文件 + fs.close({ + fd: res.fd, + }) + }, + }) +} + +// Test case from `FileSystemManager.closeSync` +{ + const fs = wx.getFileSystemManager() + const fd = fs.openSync({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + }) + + // 关闭文件 + fs.closeSync({ fd: fd }) +} + +// Test case from `FileSystemManager.fstat` +{ + const fs = wx.getFileSystemManager() + // 打开文件 + fs.open({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + success(res) { + // 获取文件的状态信息 + fs.fstat({ + fd: res.fd, + success(res) { + expectType(res.stats) + }, + }) + }, + }) +} + +// Test case from `FileSystemManager.fstatSync` +{ + const fs = wx.getFileSystemManager() + const fd = fs.openSync({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + }) + const stats = fs.fstatSync({ fd: fd }) + expectType(stats) +} + +// Test case from `FileSystemManager.ftruncate` +{ + const fs = wx.getFileSystemManager() + // 打开文件 + fs.open({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + success(res) { + // 对文件内容进行截断操作 + fs.ftruncate({ + fd: res.fd, + length: 10, // 从第10个字节开始截断文件 + success(res) { + console.log(res) + }, + }) + }, + }) +} + +// Test case from `FileSystemManager.ftruncateSync` +{ + const fs = wx.getFileSystemManager() + const fd = fs.openSync({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + }) + fs.ftruncateSync({ + fd: fd, + length: 10, // 从第10个字节开始截断文件 + }) +} + +// Test case from `FileSystemManager.open` +{ + const fs = wx.getFileSystemManager() + fs.open({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + success(res) { + expectType(res.fd) + }, + }) +} + +// Test case from `FileSystemManager.openSync` +{ + const fs = wx.getFileSystemManager() + const fd = fs.openSync({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + }) + expectType(fd) +} + +// Test case from `FileSystemManager.read` +{ + const fs = wx.getFileSystemManager() + const ab = new ArrayBuffer(1024) + // 打开文件 + fs.open({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + success(res) { + // 读取文件到 ArrayBuffer 中 + fs.read({ + fd: res.fd, + arrayBuffer: ab, + length: 10, + success(res) { + console.log(res) + }, + }) + }, + }) +} + +// Test case from `FileSystemManager.readSync` +{ + const fs = wx.getFileSystemManager() + const ab = new ArrayBuffer(1024) + const fd = fs.openSync({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + }) + const res = fs.readSync({ + fd: fd, + arrayBuffer: ab, + length: 10, + }) + console.log(res) +} + +// Test case from `FileSystemManager.truncate` +{ + const fs = wx.getFileSystemManager() + fs.truncate({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + length: 10, // 从第10个字节开始截断 + success(res) { + console.log(res) + }, + }) +} + +// Test case from `FileSystemManager.truncateSync` +{ + const fs = wx.getFileSystemManager() + fs.truncateSync({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + length: 10, // 从第10个字节开始截断 + }) +} + +// Test case from `FileSystemManager.write` +{ + const fs = wx.getFileSystemManager() + // 打开文件 + fs.open({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + success(res) { + // 写入文件 + fs.write({ + fd: res.fd, + data: 'some text', + success(res) { + expectType(res.bytesWritten) + }, + }) + }, + }) +} + +// Test case from `FileSystemManager.writeSync` +{ + const fs = wx.getFileSystemManager() + const fd = fs.openSync({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + }) + const res = fs.writeSync({ + fd: fd, + data: 'some text', + }) + expectType(res.bytesWritten) +} diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index 97eee1c..f1f7ce3 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -417,11 +417,11 @@ declare namespace WechatMiniprogram { } interface BLEPeripheralServerCloseOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: SocketTaskCloseCompleteCallback + complete?: FileSystemManagerCloseCompleteCallback /** 接口调用失败的回调函数 */ fail?: SocketTaskCloseFailCallback /** 接口调用成功的回调函数 */ - success?: SocketTaskCloseSuccessCallback + success?: FileSystemManagerCloseSuccessCallback } /** 描述service的Object */ interface BLEPeripheralService { @@ -1189,6 +1189,13 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 接口调用成功的回调函数 */ success?: CloseBluetoothAdapterSuccessCallback } + interface CloseFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'bad file descriptor': 无效的文件描述符; */ + errMsg: string + } interface CloseSocketOption { /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ code?: number @@ -1201,6 +1208,10 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 接口调用成功的回调函数 */ success?: CloseSocketSuccessCallback } + interface CloseSyncOption { + /** 需要被关闭的文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */ + fd: string + } /** 颜色。可以用以下几种方式来表示 canvas 中使用的颜色: * * - RGB 颜色: 如 `'rgb(255, 0, 0)'` @@ -1409,14 +1420,6 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb tempFilePath: string errMsg: string } - interface ConnectOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: ConnectCompleteCallback - /** 接口调用失败的回调函数 */ - fail?: ConnectFailCallback - /** 接口调用成功的回调函数 */ - success?: ConnectSuccessCallback - } interface ConnectSocketOption { /** 开发者服务器 wss 接口地址 */ url: string @@ -1541,6 +1544,20 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 视频比特率(kbps),最小值 600,最大值 3000 */ videoBitsPerSecond?: number } + interface CreateOffscreenCanvasOption { + /** 在自定义组件下,当前组件实例的 this */ + compInst?: Component.TrivialInstance | Page.TrivialInstance + /** 画布高度 */ + height?: number + /** 创建的离屏 canvas 类型 + * + * 可选值: + * - 'webgl': webgl类型上下文; + * - '2d': 2d类型上下文; */ + type?: 'webgl' | '2d' + /** 画布宽度 */ + width?: number + } interface CreateRewardedVideoAdOption { /** 广告单元 id */ adUnitId: string @@ -1762,6 +1779,16 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 本地文件大小,以字节为单位 */ size: number } + interface FileSystemManagerCloseOption { + /** 需要被关闭的文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */ + fd: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: FileSystemManagerCloseCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: FileSystemManagerCloseFailCallback + /** 接口调用成功的回调函数 */ + success?: FileSystemManagerCloseSuccessCallback + } interface FileSystemManagerGetFileInfoOption { /** 要读取的文件路径 (本地路径) */ filePath: string @@ -1844,6 +1871,63 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 接口调用成功的回调函数 */ success?: FromScreenLocationSuccessCallback } + interface FstatFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'bad file descriptor': 无效的文件描述符; + * - 'fail permission denied': 指定的 fd 路径没有读权限; */ + errMsg: string + } + interface FstatOption { + /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */ + fd: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: FstatCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: FstatFailCallback + /** 接口调用成功的回调函数 */ + success?: FstatSuccessCallback + } + interface FstatSuccessCallbackResult { + /** [Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html) + * + * Stats 对象,包含了文件的状态信息 */ + stats: Stats + errMsg: string + } + interface FstatSyncOption { + /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */ + fd: string + } + interface FtruncateFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'bad file descriptor': 无效的文件描述符; + * - 'fail permission denied': 指定的 fd 没有写权限; + * - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足; + * - 'fail sdcard not mounted': android sdcard 挂载失败; */ + errMsg: string + } + interface FtruncateOption { + /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */ + fd: string + /** 截断位置,默认0。如果 length 小于文件长度(单位:字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,则会对其进行扩展,并且扩展部分将填充空字节('\0') */ + length: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: FtruncateCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: FtruncateFailCallback + /** 接口调用成功的回调函数 */ + success?: FtruncateSuccessCallback + } + interface FtruncateSyncOption { + /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */ + fd: string + /** 截断位置,默认0。如果 length 小于文件长度(单位:字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,则会对其进行扩展,并且扩展部分将填充空字节('\0') */ + length: number + } interface GetAtqaOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: GetAtqaCompleteCallback @@ -2304,6 +2388,8 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb * - 'unknown': Android 下不常见的网络类型; * - 'none': 无网络; */ networkType: 'wifi' | '2g' | '3g' | '4g' | '5g' | 'unknown' | 'none' + /** 信号强弱,单位 dbm */ + signalStrength: number errMsg: string } interface GetRandomValuesOption { @@ -2599,23 +2685,23 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb interface GetUserProfileSuccessCallbackResult { /** 敏感数据对应的云 ID,开通[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) * - * 最低基础库: `2.16.0` */ + * 最低基础库: `2.10.4` */ cloudID: string /** 包括敏感数据在内的完整用户信息的加密数据,详见 [用户数据的签名验证和加解密]((signature#加密数据解密算法)) * - * 最低基础库: `2.16.0` */ + * 最低基础库: `2.10.4` */ encryptedData: string /** 加密算法的初始向量,详见 [用户数据的签名验证和加解密]((signature#加密数据解密算法)) * - * 最低基础库: `2.16.0` */ + * 最低基础库: `2.10.4` */ iv: string /** 不包括敏感信息的原始数据字符串,用于计算签名 * - * 最低基础库: `2.16.0` */ + * 最低基础库: `2.10.4` */ rawData: string /** 使用 sha1( rawData + sessionkey ) 得到字符串,用于校验用户信息,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) * - * 最低基础库: `2.16.0` */ + * 最低基础库: `2.10.4` */ signature: string /** [UserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/UserInfo.html) * @@ -3436,6 +3522,14 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: NdefCloseSuccessCallback } + interface NdefConnectOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ConnectCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ConnectFailCallback + /** 接口调用成功的回调函数 */ + success?: ConnectSuccessCallback + } interface NodeCallbackResult { /** 节点对应的 Node 实例 */ node: IAnyObject @@ -3473,6 +3567,15 @@ innerAudioContext.onError((res) => { /** 页面宽度( px 为单位) */ width: number } + /** 离屏 canvas 实例,可通过 [wx.createOffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html) 创建。 + * + * 最低基础库: `2.7.0` */ + interface OffscreenCanvas { + /** 画布高度 */ + height: number + /** 画布宽度 */ + width: number + } interface OnAccelerometerChangeCallbackResult { /** X 轴 */ x: number @@ -3853,6 +3956,13 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: OpenDocumentSuccessCallback } + interface OpenFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail no such file or directory "${filePath}"': 上级目录不存在; */ + errMsg: string + } interface OpenLocationOption { /** 纬度,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */ latitude: number @@ -3885,6 +3995,44 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: OpenMapAppSuccessCallback } + interface OpenOption { + /** 文件路径 (本地路径) */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: OpenCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: OpenFailCallback + /** 文件系统标志,默认值: 'r' + * + * 可选值: + * - 'a': 打开文件用于追加。 如果文件不存在,则创建该文件; + * - 'ax': 类似于 'a',但如果路径存在,则失败; + * - 'a+': 打开文件用于读取和追加。 如果文件不存在,则创建该文件; + * - 'ax+': 类似于 'a+',但如果路径存在,则失败; + * - 'as': 打开文件用于追加(在同步模式中)。 如果文件不存在,则创建该文件; + * - 'as+': 打开文件用于读取和追加(在同步模式中)。 如果文件不存在,则创建该文件; + * - 'r': 打开文件用于读取。 如果文件不存在,则会发生异常; + * - 'r+': 打开文件用于读取和写入。 如果文件不存在,则会发生异常; + * - 'w': 打开文件用于写入。 如果文件不存在则创建文件,如果文件存在则截断文件; + * - 'wx': 类似于 'w',但如果路径存在,则失败; + * - 'w+': 打开文件用于读取和写入。 如果文件不存在则创建文件,如果文件存在则截断文件; + * - 'wx+': 类似于 'w+',但如果路径存在,则失败; */ + flag?: + | 'a' + | 'ax' + | 'a+' + | 'ax+' + | 'as' + | 'as+' + | 'r' + | 'r+' + | 'w' + | 'wx' + | 'w+' + | 'wx+' + /** 接口调用成功的回调函数 */ + success?: OpenSuccessCallback + } interface OpenSettingOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: OpenSettingCompleteCallback @@ -3910,6 +4058,43 @@ innerAudioContext.onError((res) => { subscriptionsSetting: SubscriptionsSetting errMsg: string } + interface OpenSuccessCallbackResult { + /** 文件描述符 */ + fd: string + errMsg: string + } + interface OpenSyncOption { + /** 文件路径 (本地路径) */ + filePath: string + /** 文件系统标志,默认值: 'r' + * + * 可选值: + * - 'a': 打开文件用于追加。 如果文件不存在,则创建该文件; + * - 'ax': 类似于 'a',但如果路径存在,则失败; + * - 'a+': 打开文件用于读取和追加。 如果文件不存在,则创建该文件; + * - 'ax+': 类似于 'a+',但如果路径存在,则失败; + * - 'as': 打开文件用于追加(在同步模式中)。 如果文件不存在,则创建该文件; + * - 'as+': 打开文件用于读取和追加(在同步模式中)。 如果文件不存在,则创建该文件; + * - 'r': 打开文件用于读取。 如果文件不存在,则会发生异常; + * - 'r+': 打开文件用于读取和写入。 如果文件不存在,则会发生异常; + * - 'w': 打开文件用于写入。 如果文件不存在则创建文件,如果文件存在则截断文件; + * - 'wx': 类似于 'w',但如果路径存在,则失败; + * - 'w+': 打开文件用于读取和写入。 如果文件不存在则创建文件,如果文件存在则截断文件; + * - 'wx+': 类似于 'w+',但如果路径存在,则失败; */ + flag?: + | 'a' + | 'ax' + | 'a+' + | 'ax+' + | 'as' + | 'as+' + | 'r' + | 'r+' + | 'w' + | 'wx' + | 'w+' + | 'wx+' + } interface OpenVideoEditorOption { /** 视频源的路径,只支持本地路径 */ filePath: string @@ -4099,6 +4284,18 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: ReadBLECharacteristicValueSuccessCallback } + interface ReadFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'bad file descriptor': 无效的文件描述符; + * - 'fail permission denied': 指定的 fd 路径没有读权限; + * - 'fail the value of "offset" is out of range': 传入的 offset 不合法; + * - 'fail the value of "length" is out of range': 传入的 length 不合法; + * - 'fail sdcard not mounted': android sdcard 挂载失败; + * - 'bad file descriptor': 无效的文件描述符; */ + errMsg: string + } interface ReadFileFailCallbackResult { /** 错误信息 * @@ -4157,6 +4354,50 @@ innerAudioContext.onError((res) => { data: string | ArrayBuffer errMsg: string } + interface ReadOption { + /** 数据写入的缓冲区,必须是 ArrayBuffer 实例 */ + arrayBuffer: ArrayBuffer + /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */ + fd: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ReadCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ReadFailCallback + /** 要从文件中读取的字节数,默认0 */ + length?: number + /** 缓冲区中的写入偏移量,默认0 */ + offset?: number + /** 文件读取的起始位置,如不传或传 null,则会从当前文件指针的位置读取。如果 position 是正整数,则文件指针位置会保持不变并从 position 读取文件。 */ + position?: number + /** 接口调用成功的回调函数 */ + success?: ReadSuccessCallback + } + /** 文件读取结果。 通过 [FileSystemManager.readSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readSync.html) 接口返回 */ + interface ReadResult { + /** 被写入的缓存区的对象,即接口入参的 arrayBuffer */ + arrayBuffer: ArrayBuffer + /** 实际读取的字节数 */ + bytesRead: string + } + interface ReadSuccessCallbackResult { + /** 被写入的缓存区的对象,即接口入参的 arrayBuffer */ + arrayBuffer: ArrayBuffer + /** 实际读取的字节数 */ + bytesRead: string + errMsg: string + } + interface ReadSyncOption { + /** 数据写入的缓冲区,必须是 ArrayBuffer 实例 */ + arrayBuffer: ArrayBuffer + /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */ + fd: string + /** 要从文件中读取的字节数,默认0 */ + length?: number + /** 缓冲区中的写入偏移量,默认0 */ + offset?: number + /** 文件读取的起始位置,如不传或传 null,则会从当前文件指针的位置读取。如果 position 是正整数,则文件指针位置会保持不变并从 position 读取文件。 */ + position?: number + } interface ReaddirFailCallbackResult { /** 错误信息 * @@ -4504,7 +4745,7 @@ innerAudioContext.onError((res) => { extUserUin?: string /** 接口调用失败的回调函数 */ fail?: RequestOrderPaymentFailCallback - /** 订单信息,仅在需要校验的场景下需要传递,具体见[接口说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent2/API/order/requestOrderPayment.html) */ + /** 订单信息,仅在需要校验的场景下需要传递,具体见[接口说明](/miniprogram/dev/framework/ministore/minishopopencomponent2/API/order/requestOrderPayment) */ orderInfo?: IAnyObject /** 签名算法,应与后台下单时的值一致 * @@ -5425,13 +5666,13 @@ wx.createSelectorQuery() /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ code?: number /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: SocketTaskCloseCompleteCallback + complete?: FileSystemManagerCloseCompleteCallback /** 接口调用失败的回调函数 */ fail?: SocketTaskCloseFailCallback /** 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于 123 字节的 UTF-8 文本(不是字符)。 */ reason?: string /** 接口调用成功的回调函数 */ - success?: SocketTaskCloseSuccessCallback + success?: FileSystemManagerCloseSuccessCallback } interface SocketTaskOnCloseCallbackResult { /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ @@ -6185,6 +6426,41 @@ wx.getSetting({ /** 接口调用成功的回调函数 */ success?: TranslateMarkerSuccessCallback } + interface TruncateFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 所在目录不存在; + * - 'fail illegal operation on a directory, open "${filePath}"': 指定的 filePath 是一个已经存在的目录; + * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限; + * - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足; + * - 'fail sdcard not mounted': android sdcard 挂载失败; */ + errMsg: string + } + interface TruncateOption { + /** 要截断的文件路径 (本地路径) */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: TruncateCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: TruncateFailCallback + /** 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,则会对其进行扩展,并且扩展部分将填充空字节('\0') */ + length?: number + /** 接口调用成功的回调函数 */ + success?: TruncateSuccessCallback + } + interface TruncateSyncOption { + /** 要截断的文件路径 (本地路径) */ + filePath: string + /** 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,则会对其进行扩展,并且扩展部分将填充空字节('\0') */ + length?: number + } + interface UDPSocketConnectOption { + /** 要发消息的地址 */ + address: string + /** 要发送消息的端口号 */ + port: number + } interface UDPSocketOnErrorCallbackResult { /** 错误信息 */ errMsg: string @@ -6500,6 +6776,15 @@ wx.getSetting({ /** 接口调用成功的回调函数 */ success?: WriteCharacteristicValueSuccessCallback } + interface WriteFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'bad file descriptor': 无效的文件描述符; + * - 'fail permission denied': 指定的 fd 路径没有写权限; + * - 'fail sdcard not mounted': android sdcard 挂载失败; */ + errMsg: string + } interface WriteFileFailCallbackResult { /** 错误信息 * @@ -6562,6 +6847,98 @@ wx.getSetting({ /** uri 数组 */ uris?: any[] } + interface WriteOption { + /** 写入的内容,类型为 String 或 ArrayBuffer */ + data: string | ArrayBuffer + /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */ + fd: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: WriteCompleteCallback + /** 只在 data 类型是 String 时有效,指定写入文件的字符编码,默认为 utf8 + * + * 可选值: + * - 'ascii': ; + * - 'base64': ; + * - 'binary': ; + * - 'hex': ; + * - 'ucs2': 以小端序读取; + * - 'ucs-2': 以小端序读取; + * - 'utf16le': 以小端序读取; + * - 'utf-16le': 以小端序读取; + * - 'utf-8': ; + * - 'utf8': ; + * - 'latin1': ; */ + encoding?: + | 'ascii' + | 'base64' + | 'binary' + | 'hex' + | 'ucs2' + | 'ucs-2' + | 'utf16le' + | 'utf-16le' + | 'utf-8' + | 'utf8' + | 'latin1' + /** 接口调用失败的回调函数 */ + fail?: WriteFailCallback + /** 只在 data 类型是 ArrayBuffer 时有效,指定要写入的字节数,默认为 arrayBuffer 从0开始偏移 offset 个字节后剩余的字节数 */ + length?: number + /** 只在 data 类型是 ArrayBuffer 时有效,决定 arrayBuffe 中要被写入的部位,即 arrayBuffer 中的索引,默认0 */ + offset?: number + /** 指定文件开头的偏移量,即数据要被写入的位置。当 position 不传或者传入非 Number 类型的值时,数据会被写入当前指针所在位置。 */ + position?: number + /** 接口调用成功的回调函数 */ + success?: WriteSuccessCallback + } + /** 文件写入结果。 通过 [FileSystemManager.writeSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeSync.html) 接口返回 */ + interface WriteResult { + /** 实际被写入到文件中的字节数(注意,被写入的字节数不一定与被写入的字符串字符数相同) */ + bytesWritten: number + } + interface WriteSuccessCallbackResult { + /** 实际被写入到文件中的字节数(注意,被写入的字节数不一定与被写入的字符串字符数相同) */ + bytesWritten: number + errMsg: string + } + interface WriteSyncOption { + /** 写入的内容,类型为 String 或 ArrayBuffer */ + data: string | ArrayBuffer + /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */ + fd: string + /** 只在 data 类型是 String 时有效,指定写入文件的字符编码,默认为 utf8 + * + * 可选值: + * - 'ascii': ; + * - 'base64': ; + * - 'binary': ; + * - 'hex': ; + * - 'ucs2': 以小端序读取; + * - 'ucs-2': 以小端序读取; + * - 'utf16le': 以小端序读取; + * - 'utf-16le': 以小端序读取; + * - 'utf-8': ; + * - 'utf8': ; + * - 'latin1': ; */ + encoding?: + | 'ascii' + | 'base64' + | 'binary' + | 'hex' + | 'ucs2' + | 'ucs-2' + | 'utf16le' + | 'utf-16le' + | 'utf-8' + | 'utf8' + | 'latin1' + /** 只在 data 类型是 ArrayBuffer 时有效,指定要写入的字节数,默认为 arrayBuffer 从0开始偏移 offset 个字节后剩余的字节数 */ + length?: number + /** 只在 data 类型是 ArrayBuffer 时有效,决定 arrayBuffe 中要被写入的部位,即 arrayBuffer 中的索引,默认0 */ + offset?: number + /** 指定文件开头的偏移量,即数据要被写入的位置。当 position 不传或者传入非 Number 类型的值时,数据会被写入当前指针所在位置。 */ + position?: number + } interface WxGetFileInfoOption { /** 本地文件路径 (本地路径) */ filePath: string @@ -8775,6 +9152,18 @@ ctx.draw() color: string ): void } + interface CloseSyncError { + /** 错误信息 + * + * | 错误信息 | 说明 | + * | - | - | + * | bad file descriptor | 无效的文件描述符 | */ errMsg: string + /** 错误码 + * + * | 错误信息 | 说明 | + * | - | - | + * | bad file descriptor | 无效的文件描述符 | */ errCode: number + } interface Console { /** [console.debug()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.debug.html) * @@ -9137,6 +9526,30 @@ this.editorCtx.insertImage({ | 'utf8' | 'latin1' ): void + /** [FileSystemManager.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.close.html) +* +* 关闭文件 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +// 打开文件 +fs.open({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + success(res) { + // 关闭文件 + fs.close({ + fd: res.fd + }) + } +}) +``` +* +* 最低基础库: `2.16.1` */ + close(option: FileSystemManagerCloseOption): void /** [FileSystemManager.copyFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html) * * 复制文件 */ @@ -9150,6 +9563,61 @@ this.editorCtx.insertImage({ /** 目标文件路径,支持本地路径 */ destPath: string ): void + /** [FileSystemManager.fstat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.fstat.html) +* +* 获取文件的状态信息 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +// 打开文件 +fs.open({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + success(res) { + // 获取文件的状态信息 + fs.fstat({ + fd: res.fd, + success(res) { + console.log(res.stats) + } + }) + } +}) +``` +* +* 最低基础库: `2.16.1` */ + fstat(option: FstatOption): void + /** [FileSystemManager.ftruncate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.ftruncate.html) +* +* 对文件内容进行截断操作 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +// 打开文件 +fs.open({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + success(res) { + // 对文件内容进行截断操作 + fs.ftruncate({ + fd: res.fd, + length: 10, // 从第10个字节开始截断文件 + success(res) { + console.log(res) + } + }) + } +}) +``` +* +* 最低基础库: `2.16.1` */ + ftruncate(option: FtruncateOption): void /** [FileSystemManager.getFileInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.getFileInfo.html) * * 获取该小程序下的 本地临时文件 或 本地缓存文件 信息 */ @@ -9173,6 +9641,56 @@ this.editorCtx.insertImage({ * 最低基础库: `2.3.0` */ recursive?: boolean ): void + /** [FileSystemManager.open(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) +* +* 打开文件,返回文件描述符 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.open({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + success(res) { + console.log(res.fd) + } +}) +``` +* +* 最低基础库: `2.16.1` */ + open(option: OpenOption): void + /** [FileSystemManager.read(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.read.html) +* +* 读文件 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +const ab = new ArrayBuffer(1024) +// 打开文件 +fs.open({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + success(res) { + // 读取文件到 ArrayBuffer 中 + fs.read({ + fd: res.fd, + arrayBuffer: ab, + length: 10, + success(res) { + console.log(res) + } + }) + } +}) +``` +* +* 最低基础库: `2.16.1` */ + read(option: ReadOption): void /** [FileSystemManager.readFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html) * * 读取本地文件内容 */ @@ -9221,6 +9739,26 @@ this.editorCtx.insertImage({ * * 获取文件 Stats 对象 */ stat(option: StatOption): void + /** [FileSystemManager.truncate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.truncate.html) +* +* 对文件内容进行截断操作 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.truncate({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + length: 10, // 从第10个字节开始截断 + success(res) { + console.log(res) + } +}) +``` +* +* 最低基础库: `2.16.1` */ + truncate(option: TruncateOption): void /** [FileSystemManager.unlink(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlink.html) * * 删除文件 */ @@ -9236,6 +9774,34 @@ this.editorCtx.insertImage({ * * 解压文件 */ unzip(option: UnzipOption): void + /** [FileSystemManager.write(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.write.html) +* +* 写入文件 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +// 打开文件 +fs.open({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + success(res) { + // 写入文件 + fs.write({ + fd: res.fd, + data: 'some text', + success(res) { + console.log(res.bytesWritten) + } + }) + } +}) +``` +* +* 最低基础库: `2.16.1` */ + write(option: WriteOption): void /** [FileSystemManager.writeFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFile.html) * * 写文件 */ @@ -9275,6 +9841,49 @@ this.editorCtx.insertImage({ | 'utf8' | 'latin1' ): void + /** [[ReadResult](https://developers.weixin.qq.com/miniprogram/dev/api/file/ReadResult.html) FileSystemManager.readSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readSync.html) +* +* 读文件 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +const ab = new ArrayBuffer(1024) +const fd = fs.openSync({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+' +}) +const res = fs.readSync({ + fd: fd, + arrayBuffer: ab, + length: 10 +}) +console.log(res) +``` +* +* 最低基础库: `2.16.1` */ + readSync(option: ReadSyncOption): ReadResult + /** [[Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html) FileSystemManager.fstatSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.fstatSync.html) +* +* 同步获取文件的状态信息 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +const fd = fs.openSync({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+' +}) +const stats = fs.fstatSync({fd: fd}) +console.log(stats) +``` +* +* 最低基础库: `2.16.1` */ + fstatSync(option: FstatSyncOption): Stats /** [[Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)|Object FileSystemManager.statSync(string path, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.statSync.html) * * [FileSystemManager.stat](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.stat.html) 的同步版本 */ @@ -9286,6 +9895,46 @@ this.editorCtx.insertImage({ * 最低基础库: `2.3.0` */ recursive?: boolean ): Stats | IAnyObject + /** [[WriteResult](https://developers.weixin.qq.com/miniprogram/dev/api/file/WriteResult.html) FileSystemManager.writeSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeSync.html) +* +* 同步写入文件 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +const fd = fs.openSync({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+' +}) +const res = fs.writeSync({ + fd: fd, + data: 'some text' +}) +console.log(res.bytesWritten) +``` +* +* 最低基础库: `2.16.1` */ + writeSync(option: WriteSyncOption): WriteResult + /** [string FileSystemManager.openSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) +* +* 同步打开文件,返回文件描述符 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +const fd = fs.openSync({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+' +}) +console.log(fd) +``` +* +* 最低基础库: `2.16.1` */ + openSync(option: OpenSyncOption): string /** [string FileSystemManager.saveFileSync(string tempFilePath, string filePath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFileSync.html) * * [FileSystemManager.saveFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFile.html) 的同步版本 */ @@ -9336,6 +9985,96 @@ this.editorCtx.insertImage({ * 最低基础库: `2.10.0` */ length?: number ): string | ArrayBuffer + /** [undefined FileSystemManager.closeSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.closeSync.html) +* +* 同步关闭文件 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +const fd = fs.openSync({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+' +}) + +// 关闭文件 +fs.closeSync({fd: fd}) +``` +* +* 最低基础库: `2.16.1` */ + closeSync(option: CloseSyncOption): undefined + /** [undefined FileSystemManager.ftruncateSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.ftruncateSync.html) +* +* 对文件内容进行截断操作 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +const fd = fs.openSync({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+' +}) +fs.ftruncateSync({ + fd: fd, + length: 10 // 从第10个字节开始截断文件 +}) +``` +* +* 最低基础库: `2.16.1` */ + ftruncateSync(option: FtruncateSyncOption): undefined + /** [undefined FileSystemManager.truncateSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.truncateSync.html) +* +* 对文件内容进行截断操作 (truncate 的同步版本) +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.truncateSync({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + length: 10, // 从第10个字节开始截断 +}) +``` +* +* 最低基础库: `2.16.1` */ + truncateSync(option: TruncateSyncOption): undefined + } + interface FstatSyncError { + /** 错误信息 + * + * | 错误信息 | 说明 | + * | - | - | + * | bad file descriptor | 无效的文件描述符 | + * | fail permission denied | 指定的 fd 路径没有读权限 | */ errMsg: string + /** 错误码 + * + * | 错误信息 | 说明 | + * | - | - | + * | bad file descriptor | 无效的文件描述符 | + * | fail permission denied | 指定的 fd 路径没有读权限 | */ errCode: number + } + interface FtruncateSyncError { + /** 错误信息 + * + * | 错误信息 | 说明 | + * | - | - | + * | bad file descriptor | 无效的文件描述符 | + * | fail permission denied | 指定的 fd 没有写权限 | + * | fail the maximum size of the file storage limit is exceeded | 存储空间不足 | + * | fail sdcard not mounted | android sdcard 挂载失败 | */ errMsg: string + /** 错误码 + * + * | 错误信息 | 说明 | + * | - | - | + * | bad file descriptor | 无效的文件描述符 | + * | fail permission denied | 指定的 fd 没有写权限 | + * | fail the maximum size of the file storage limit is exceeded | 存储空间不足 | + * | fail sdcard not mounted | android sdcard 挂载失败 | */ errCode: number } interface GeneralCallbackResult { errMsg: string @@ -9640,7 +10379,7 @@ Page({ * 监听插屏广告关闭事件。 */ onClose( /** 插屏广告关闭事件的回调函数 */ - callback: InterstitialAdOnCloseCallback + callback: UDPSocketOnCloseCallback ): void /** [InterstitialAd.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onError.html) * @@ -9710,7 +10449,7 @@ Page({ * 连接 NFC 标签 * * 最低基础库: `2.11.2` */ - connect(option?: ConnectOption): void + connect(option?: NdefConnectOption): void /** [IsoDep.getHistoricalBytes(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.getHistoricalBytes.html) * * 获取复位信息 @@ -10205,12 +10944,6 @@ Page({ ): void } interface MediaRecorder { - /** [MediaRecorder.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.destroy.html) - * - * 销毁录制器 - * - * 最低基础库: `2.11.0` */ - destroy(): void /** [MediaRecorder.off(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.off.html) * * 取消监听录制事件。当对应事件触发时,该回调函数不再执行。 @@ -10237,36 +10970,42 @@ Page({ /** 事件触发时执行的回调函数 */ callback: (...args: any[]) => any ): void - /** [MediaRecorder.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.pause.html) + /** [Promise MediaRecorder.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.destroy.html) + * + * 销毁录制器 + * + * 最低基础库: `2.11.0` */ + destroy(): Promise + /** [Promise MediaRecorder.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.pause.html) * * 暂停录制 * * 最低基础库: `2.11.0` */ - pause(): void - /** [MediaRecorder.requestFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.requestFrame.html) + pause(): Promise + /** [Promise MediaRecorder.requestFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.requestFrame.html) * * 请求下一帧录制,在 callback 里完成一帧渲染后开始录制当前帧 * * 最低基础库: `2.11.0` */ - requestFrame(callback: (...args: any[]) => any): void - /** [MediaRecorder.resume()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.resume.html) + requestFrame(callback: (...args: any[]) => any): Promise + /** [Promise MediaRecorder.resume()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.resume.html) * * 恢复录制 * * 最低基础库: `2.11.0` */ - resume(): void - /** [MediaRecorder.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.start.html) + resume(): Promise + /** [Promise MediaRecorder.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.start.html) * * 开始录制 * * 最低基础库: `2.11.0` */ - start(): void - /** [MediaRecorder.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.stop.html) + start(): Promise + /** [Promise MediaRecorder.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.stop.html) * * 结束录制 * * 最低基础库: `2.11.0` */ - stop(): void + stop(): Promise } interface MifareClassic { /** [MifareClassic.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.close.html) @@ -10280,7 +11019,7 @@ Page({ * 连接 NFC 标签 * * 最低基础库: `2.11.2` */ - connect(option?: ConnectOption): void + connect(option?: NdefConnectOption): void /** [MifareClassic.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.getMaxTransceiveLength.html) * * 获取最大传输长度 @@ -10318,7 +11057,7 @@ Page({ * 连接 NFC 标签 * * 最低基础库: `2.11.2` */ - connect(option?: ConnectOption): void + connect(option?: NdefConnectOption): void /** [MifareUltralight.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.getMaxTransceiveLength.html) * * 获取最大传输长度 @@ -10462,7 +11201,7 @@ Page({ * 连接 NFC 标签 * * 最低基础库: `2.11.2` */ - connect(option?: ConnectOption): void + connect(option?: NdefConnectOption): void /** [Ndef.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.isConnected.html) * * 检查是否已连接 @@ -10506,7 +11245,7 @@ Page({ * 连接 NFC 标签 * * 最低基础库: `2.11.2` */ - connect(option?: ConnectOption): void + connect(option?: NdefConnectOption): void /** [NfcA.getAtqa(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getAtqa.html) * * 获取ATQA信息 @@ -10556,7 +11295,7 @@ Page({ * 连接 NFC 标签 * * 最低基础库: `2.11.2` */ - connect(option?: ConnectOption): void + connect(option?: NdefConnectOption): void /** [NfcB.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.getMaxTransceiveLength.html) * * 获取最大传输长度 @@ -10594,7 +11333,7 @@ Page({ * 连接 NFC 标签 * * 最低基础库: `2.11.2` */ - connect(option?: ConnectOption): void + connect(option?: NdefConnectOption): void /** [NfcF.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.getMaxTransceiveLength.html) * * 获取最大传输长度 @@ -10632,7 +11371,7 @@ Page({ * 连接 NFC 标签 * * 最低基础库: `2.11.2` */ - connect(option?: ConnectOption): void + connect(option?: NdefConnectOption): void /** [NfcV.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.getMaxTransceiveLength.html) * * 获取最大传输长度 @@ -10854,24 +11593,46 @@ Page({ ): SelectorQuery } interface OffscreenCanvas { + /** [[Image](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Image.html) OffscreenCanvas.createImage()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.createImage.html) + * + * 创建一个图片对象。支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。 + * + * **** + * + * 注意不允许混用 webgl 和 2d 画布创建的图片对象,使用时请注意尽量使用 canvas 自身的 `createImage` 创建图片对象。 + * + * 最低基础库: `2.7.3` */ + createImage(): Image /** [[RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) OffscreenCanvas.getContext(string contextType)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.getContext.html) * * 该方法返回 OffscreenCanvas 的绘图上下文 * * **** * - * 注意不允许混用 WebGL 和 2d 绘图上下文 + * 注意不允许混用 webgl 和 2d 绘图上下文,传入的 contextType 必须要与 `wx.createOffscreenCanvas` 传入的 type 类型一致。 * * 最低基础库: `2.7.0` */ getContext( - /** + /** 绘图上下文类型,需要与 createOffscreenCanvas 时传入的 type 一致 * * 参数 contextType 可选值: - * - 'webgl': 创建 WebGL 绘图上下文; - * - '2d': 创建 2d 绘图上下文; */ + * - 'webgl': webgl类型上下文; + * - '2d': 2d类型上下文; */ contextType: 'webgl' | '2d' ): any } + interface OpenSyncError { + /** 错误信息 + * + * | 错误信息 | 说明 | + * | - | - | + * | fail no such file or directory "${filePath}" | 上级目录不存在 | */ errMsg: string + /** 错误码 + * + * | 错误信息 | 说明 | + * | - | - | + * | fail no such file or directory "${filePath}" | 上级目录不存在 | */ errCode: number + } interface Performance { /** [Array Performance.getEntries()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.getEntries.html) * @@ -10921,6 +11682,28 @@ Page({ options: IAnyObject ): void } + interface ReadSyncError { + /** 错误信息 + * + * | 错误信息 | 说明 | + * | - | - | + * | bad file descriptor | 无效的文件描述符 | + * | fail permission denied | 指定的 fd 路径没有读权限 | + * | fail the value of "offset" is out of range | 传入的 offset 不合法 | + * | fail the value of "length" is out of range | 传入的 length 不合法 | + * | fail sdcard not mounted | android sdcard 挂载失败 | + * | bad file descriptor | 无效的文件描述符 | */ errMsg: string + /** 错误码 + * + * | 错误信息 | 说明 | + * | - | - | + * | bad file descriptor | 无效的文件描述符 | + * | fail permission denied | 指定的 fd 路径没有读权限 | + * | fail the value of "offset" is out of range | 传入的 offset 不合法 | + * | fail the value of "length" is out of range | 传入的 length 不合法 | + * | fail sdcard not mounted | android sdcard 挂载失败 | + * | bad file descriptor | 无效的文件描述符 | */ errCode: number + } interface RealtimeLogManager { /** [RealtimeLogManager.addFilterMsg(string msg)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.addFilterMsg.html) * @@ -11237,7 +12020,7 @@ Page({ ): void } interface ScrollViewContext { - /** [ScrollViewContext.scrollIntoView(string selector)](https://developers.weixin.qq.com/miniprogram/dev/api/media/scrollview/ScrollViewContext.scrollIntoView.html) + /** [ScrollViewContext.scrollIntoView(string selector)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.scrollIntoView.html) * * 滚动至指定位置 * @@ -11246,7 +12029,7 @@ Page({ /** 元素选择器 */ selector: string ): void - /** [ScrollViewContext.scrollTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/scrollview/ScrollViewContext.scrollTo.html) + /** [ScrollViewContext.scrollTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.scrollTo.html) * * 滚动至指定位置 * @@ -11375,11 +12158,37 @@ Component({ * 判断当前文件是否一个普通文件 */ isFile(): boolean } + interface TruncateSyncError { + /** 错误信息 + * + * | 错误信息 | 说明 | + * | - | - | + * | fail no such file or directory, open ${filePath} | 指定的 filePath 所在目录不存在 | + * | fail illegal operation on a directory, open "${filePath}" | 指定的 filePath 是一个已经存在的目录 | + * | fail permission denied, open ${dirPath} | 指定的 filePath 路径没有写权限 | + * | fail the maximum size of the file storage limit is exceeded | 存储空间不足 | + * | fail sdcard not mounted | android sdcard 挂载失败 | */ errMsg: string + /** 错误码 + * + * | 错误信息 | 说明 | + * | - | - | + * | fail no such file or directory, open ${filePath} | 指定的 filePath 所在目录不存在 | + * | fail illegal operation on a directory, open "${filePath}" | 指定的 filePath 是一个已经存在的目录 | + * | fail permission denied, open ${dirPath} | 指定的 filePath 路径没有写权限 | + * | fail the maximum size of the file storage limit is exceeded | 存储空间不足 | + * | fail sdcard not mounted | android sdcard 挂载失败 | */ errCode: number + } interface UDPSocket { /** [UDPSocket.close()](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.close.html) * * 关闭 UDP Socket 实例,相当于销毁。 在关闭之后,UDP Socket 实例不能再发送消息,每次调用 `UDPSocket.send` 将会触发错误事件,并且 message 事件回调函数也不会再也执行。在 `UDPSocket` 实例被创建后将被 Native 强引用,保证其不被 GC。在 `UDPSocket.close` 后将解除对其的强引用,让 UDPSocket 实例遵从 GC。 */ close(): void + /** [UDPSocket.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.connect.html) + * + * 预先连接到指定的 IP 和 port,需要配合 write 方法一起使用 + * + * 最低基础库: `2.15.0` */ + connect(option: UDPSocketConnectOption): void /** [UDPSocket.offClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offClose.html) * * 取消监听关闭事件 */ @@ -11440,6 +12249,12 @@ Component({ * * 向指定的 IP 和 port 发送消息 */ send(option: UDPSocketSendOption): void + /** [UDPSocket.write()](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.write.html) + * + * 用法与 send 方法相同,如果没有预先调用 connect 则与 send 无差异(注意即使调用了 connect 也需要在本接口填入地址和端口参数) + * + * 最低基础库: `2.15.0` */ + write(): void /** [number UDPSocket.bind(number port)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.bind.html) * * 绑定一个系统随机分配的可用端口,或绑定一个指定的端口号 */ @@ -11607,6 +12422,33 @@ Component({ * * 最低基础库: `2.11.0` */ getFrameData(): FrameDataOptions + /** [Promise VideoDecoder.remove()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.remove.html) + * + * 移除解码器 + * + * 最低基础库: `2.11.0` */ + remove(): Promise + /** [Promise VideoDecoder.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.seek.html) + * + * 跳到某个时间点解码 + * + * 最低基础库: `2.11.0` */ + seek( + /** 跳转的解码位置,单位 ms */ + position: number + ): Promise + /** [Promise VideoDecoder.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.start.html) + * + * 开始解码 + * + * 最低基础库: `2.11.0` */ + start(option: VideoDecoderStartOption): Promise + /** [Promise VideoDecoder.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.stop.html) + * + * 停止解码 + * + * 最低基础库: `2.11.0` */ + stop(): Promise /** [VideoDecoder.off(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.off.html) * * 取消监听录制事件。当对应事件触发时,该回调函数不再执行 @@ -11636,33 +12478,6 @@ Component({ /** 事件触发时执行的回调函数 */ callback: (...args: any[]) => any ): void - /** [VideoDecoder.remove()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.remove.html) - * - * 移除解码器 - * - * 最低基础库: `2.11.0` */ - remove(): void - /** [VideoDecoder.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.seek.html) - * - * 跳到某个时间点解码 - * - * 最低基础库: `2.11.0` */ - seek( - /** 跳转的解码位置,单位 ms */ - position: number - ): void - /** [VideoDecoder.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.start.html) - * - * 开始解码 - * - * 最低基础库: `2.11.0` */ - start(option: VideoDecoderStartOption): void - /** [VideoDecoder.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.stop.html) - * - * 停止解码 - * - * 最低基础库: `2.11.0` */ - stop(): void } interface WifiError { /** 错误信息 @@ -11712,7 +12527,7 @@ Component({ ): void /** [Worker.onProcessKilled(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.onProcessKilled.html) * - * 监听 worker线程被系统回收事件(当iOS系统资源紧张时,worker线程存在被系统回收的可能,开发者可监听此事件并重新创建一个worker) */ + * 监听 worker线程被系统回收事件(当iOS系统资源紧张时,worker线程存在被系统回收的可能,开发者可监听此事件并重新创建一个worker)。仅限在主线程 worker 对象上调用。 */ onProcessKilled( /** worker线程被系统回收事件的回调函数 */ callback: OnProcessKilledCallback @@ -11748,6 +12563,22 @@ worker.postMessage({ * 结束当前 Worker 线程。仅限在主线程 worker 对象上调用。 */ terminate(): void } + interface WriteSyncError { + /** 错误信息 + * + * | 错误信息 | 说明 | + * | - | - | + * | bad file descriptor | 无效的文件描述符 | + * | fail permission denied | 指定的 fd 路径没有写权限 | + * | fail sdcard not mounted | android sdcard 挂载失败 | */ errMsg: string + /** 错误码 + * + * | 错误信息 | 说明 | + * | - | - | + * | bad file descriptor | 无效的文件描述符 | + * | fail permission denied | 指定的 fd 路径没有写权限 | + * | fail sdcard not mounted | android sdcard 挂载失败 | */ errCode: number + } interface Wx { /** [ArrayBuffer wx.base64ToArrayBuffer(string base64)](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.base64ToArrayBuffer.html) * @@ -12132,11 +12963,33 @@ logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3]) * * 最低基础库: `2.11.2` */ getNFCAdapter(): NFCAdapter - /** [[OffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.html) wx.createOffscreenCanvas(number width, number height, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html) + /** [[OffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.html) wx.createOffscreenCanvas(object object, number width, number height, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html) * * 创建离屏 canvas 实例 * - * 最低基础库: `2.7.0` */ + * **离屏 Canvas 类型不可混用** + * + * + * 由于 webgl canvas 和 2d canvas 的底层实现方式不同,因此必须要在调用 `wx.createOffscreenCanvas` 时提前指定类型。 + * + * 指定类型后,离屏 canvas `getContext(type)` 调用不允许混用,如不能对 webgl canvas 调用 `getContext('2d')`。 + * + * 同样的,不同类型 canvas 调用 `createImage` 创建的图片对象也不支持混用,使用时请注意尽量使用 canvas 自身的 `createImage` 创建图片对象。 + * + * **与 MediaRecorder 结合** + * + * + * 离屏 webgl canvas 支持作为参数传递给 [`wx.createMediaRecorder`](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/wx.createMediaRecorder.html), 离屏 2d canvas 暂不支持。 + * + * **旧版 createOffscreenCanvas** + * + * + * 旧版函数签名为 `wx.createOffscreenCanvas(width: number, height: number, this: object): OffscreenCanvas`,从基础库 2.7.0 开始支持 + * + * 从基础库 2.16.1 开始改为 `wx.createOffscreenCanvas(options: object): OffscreenCanvas`,向下兼容旧版入参。 + * 但需注意旧版入参只能创建 webgl 类型,如需创建 2d 类型则必须使用新版。 + * + * 最低基础库: `2.16.1` */ createOffscreenCanvas( /** 画布宽度 */ width: number, @@ -12145,6 +12998,36 @@ logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3]) /** 在自定义组件下,当前组件实例的 this */ component?: Component.TrivialInstance | Page.TrivialInstance ): OffscreenCanvas + /** [[OffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.html) wx.createOffscreenCanvas(object object, number width, number height, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html) + * + * 创建离屏 canvas 实例 + * + * **离屏 Canvas 类型不可混用** + * + * + * 由于 webgl canvas 和 2d canvas 的底层实现方式不同,因此必须要在调用 `wx.createOffscreenCanvas` 时提前指定类型。 + * + * 指定类型后,离屏 canvas `getContext(type)` 调用不允许混用,如不能对 webgl canvas 调用 `getContext('2d')`。 + * + * 同样的,不同类型 canvas 调用 `createImage` 创建的图片对象也不支持混用,使用时请注意尽量使用 canvas 自身的 `createImage` 创建图片对象。 + * + * **与 MediaRecorder 结合** + * + * + * 离屏 webgl canvas 支持作为参数传递给 [`wx.createMediaRecorder`](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/wx.createMediaRecorder.html), 离屏 2d canvas 暂不支持。 + * + * **旧版 createOffscreenCanvas** + * + * + * 旧版函数签名为 `wx.createOffscreenCanvas(width: number, height: number, this: object): OffscreenCanvas`,从基础库 2.7.0 开始支持 + * + * 从基础库 2.16.1 开始改为 `wx.createOffscreenCanvas(options: object): OffscreenCanvas`,向下兼容旧版入参。 + * 但需注意旧版入参只能创建 webgl 类型,如需创建 2d 类型则必须使用新版。 + * + * 最低基础库: `2.16.1` */ + createOffscreenCanvas( + option: CreateOffscreenCanvasOption + ): OffscreenCanvas /** [[Performance](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.html) wx.getPerformance()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/wx.getPerformance.html) * * 获取当前小程序性能相关的信息。 @@ -12358,7 +13241,7 @@ wx.chooseImage({ createVideoDecoder(): VideoDecoder /** [[Worker](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.html) wx.createWorker(string scriptPath, object options)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/wx.createWorker.html) * -* 创建一个 [Worker 线程](https://developers.weixin.qq.com/miniprogram/dev/framework/workers.html) +* 创建一个 Worker 线程 * * **示例代码** * @@ -12725,7 +13608,6 @@ wx.checkIsSupportSoterAuthentication({ /** [wx.checkSession(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.checkSession.html) * * 检查登录态是否过期。 -* * 通过 wx.login 接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能失效。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。开发者只需要调用 wx.checkSession 接口检测当前用户登录态是否有效。 * * 登录态过期后开发者可以再调用 wx.login 获取新的用户登录态。调用成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。 @@ -13069,6 +13951,11 @@ wx.connectWifi({ }) ``` * +* **注意** +* +* +* Android 7.0.22 以上微信 connectWifi 的实现在Android 10及以上的手机无法生效,对于 Android 10 及以上手机 连接 wifi 之后,(受系统能力限制)其他进程无法使用当前连接的 wifi;配置 maunal 连上的 wifi 才是整个设备可用的。 +* * 最低基础库: `1.6.0` */ connectWifi( option: T @@ -13944,13 +14831,20 @@ Page({ ): PromisifySuccessResult /** [wx.getUserProfile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html) * -* 获取用户信息。每次请求都会弹出授权窗口,用户同意后返回 `userInfo`。 +* 获取用户信息。页面产生点击事件(例如 `button` 上 `bindtap` 的回调中)后才可调用,每次请求都会弹出授权窗口,用户同意后返回 `userInfo`。该接口用于替换 `wx.getUserInfo`,详见 [用户信息接口调整说明](https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801?highLine=login)。 * * **示例代码** * * * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/tsJaq2mP7Mp4) * +* **Bug & Tip** +* +* +* 1. `tip`:仅小程序中 `wx.getUserInfo` 接口进行调整,小游戏中不受影响; +* 2. `tip`:开发者工具中仅 2.10.4 及以上版本可访问 `wx.getUserProfile` 接口,在真机上可参考示例代码进行判断,无需根据版本号或者 `canIUse` 进行条件。 +* 3. `tip`:`wx.getUserprofile` 返回的加密数据中不包含 `openId` 和 `unionId` 字段。 +* * ```html * * @@ -15860,9 +16754,13 @@ wx.reportPerformance(1101, 680, 'custom') /** [wx.requestOrderPayment(Object args)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/payment/wx.requestOrderPayment.html) * * 创建自定义版交易组件订单,并发起支付。 - * 接入自定义版交易组件之后,若要发起微信支付,请先查询[需要校验的场景](https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent2/API/order/check_scene.html)。 - * 在需要校验的场景中,发起微信支付时,必须使用该接口,需要按照要求传入相关的[订单信息](https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent2/API/order/add_order.html)进行校验,校验通过后用户才可以完成当前订单的支付,非需要校验的场景则可以按照商家要求自行选择传入订单信息或不传入。 - * 除订单信息以外,具体使用方式与[wx.requestPayment](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/payment/wx.requestPayment.html)相同。 + * 仅接入了[自定义版交易组件](/miniprogram/dev/framework/ministore/minishopopencomponent2/Introduction2)的小程序需要使用,普通小程序可直接使用 [`wx.requestPayment`](./wx.requestPayment)。 + * + * **前置检查** + * + * + * 接入自定义版交易组件之后,若要发起微信支付,请先查询[需要校验的场景](/miniprogram/dev/framework/ministore/minishopopencomponent2/API/order/check_scene)。 + * 在需要校验的场景中,发起微信支付时,必须使用该接口,需要按照要求传入相关的[订单信息](/miniprogram/dev/framework/ministore/minishopopencomponent2/API/order/add_order)进行校验,校验通过后用户才可以完成当前订单的支付,非需要校验的场景则可以按照商家要求自行选择传入订单信息或不传入。 * * 最低基础库: `2.16.0` */ requestOrderPayment< @@ -16085,7 +16983,9 @@ wx.scanCode({ console.log(res) } }) -``` */ +``` +* +* 最低基础库: `1.0.0` */ scanCode( option: T ): PromisifySuccessResult @@ -17810,6 +18710,18 @@ wx.writeBLECharacteristicValue({ /** 节点的相关信息 */ res: IAnyObject ) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type FileSystemManagerCloseCompleteCallback = ( + res: GeneralCallbackResult + ) => void + /** 接口调用失败的回调函数 */ + type FileSystemManagerCloseFailCallback = ( + result: CloseFailCallbackResult + ) => void + /** 接口调用成功的回调函数 */ + type FileSystemManagerCloseSuccessCallback = ( + res: GeneralCallbackResult + ) => void /** 接口调用失败的回调函数 */ type FileSystemManagerGetFileInfoFailCallback = ( result: GetFileInfoFailCallbackResult @@ -17841,6 +18753,18 @@ wx.writeBLECharacteristicValue({ result: GetCenterLocationSuccessCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type FstatCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type FstatFailCallback = (result: FstatFailCallbackResult) => void + /** 接口调用成功的回调函数 */ + type FstatSuccessCallback = (result: FstatSuccessCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type FtruncateCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type FtruncateFailCallback = (result: FtruncateFailCallbackResult) => void + /** 接口调用成功的回调函数 */ + type FtruncateSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type GetAtqaCompleteCallback = (res: Nfcrwerror) => void /** 接口调用失败的回调函数 */ type GetAtqaFailCallback = (res: Nfcrwerror) => void @@ -18337,8 +19261,6 @@ wx.writeBLECharacteristicValue({ type InterstitialAdOffErrorCallback = ( result: InterstitialAdOnErrorCallbackResult ) => void - /** 插屏广告关闭事件的回调函数 */ - type InterstitialAdOnCloseCallback = (res: GeneralCallbackResult) => void /** 插屏错误事件的回调函数 */ type InterstitialAdOnErrorCallback = ( result: InterstitialAdOnErrorCallbackResult @@ -18811,11 +19733,15 @@ wx.writeBLECharacteristicValue({ /** 接口调用成功的回调函数 */ type OpenCardSuccessCallback = (res: GeneralCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type OpenCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type OpenDocumentCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type OpenDocumentFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type OpenDocumentSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type OpenFailCallback = (result: OpenFailCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type OpenLocationCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ @@ -18836,6 +19762,8 @@ wx.writeBLECharacteristicValue({ type OpenSettingSuccessCallback = ( result: OpenSettingSuccessCallbackResult ) => void + /** 接口调用成功的回调函数 */ + type OpenSuccessCallback = (result: OpenSuccessCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type OpenVideoEditorCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ @@ -18935,6 +19863,10 @@ wx.writeBLECharacteristicValue({ res: BluetoothError ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type ReadCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type ReadFailCallback = (result: ReadFailCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ReadFileCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type ReadFileFailCallback = (result: ReadFileFailCallbackResult) => void @@ -18942,6 +19874,8 @@ wx.writeBLECharacteristicValue({ type ReadFileSuccessCallback = ( result: ReadFileSuccessCallbackResult ) => void + /** 接口调用成功的回调函数 */ + type ReadSuccessCallback = (result: ReadSuccessCallbackResult) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type ReaddirCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ @@ -19467,12 +20401,8 @@ wx.writeBLECharacteristicValue({ type SnapshotCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type SnapshotFailCallback = (res: GeneralCallbackResult) => void - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - type SocketTaskCloseCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type SocketTaskCloseFailCallback = (res: GeneralCallbackResult) => void - /** 接口调用成功的回调函数 */ - type SocketTaskCloseSuccessCallback = (res: GeneralCallbackResult) => void /** WebSocket 连接关闭事件的回调函数 */ type SocketTaskOnCloseCallback = ( result: SocketTaskOnCloseCallbackResult @@ -19843,12 +20773,17 @@ wx.writeBLECharacteristicValue({ type TranslateMarkerFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ type TranslateMarkerSuccessCallback = (res: GeneralCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type TruncateCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type TruncateFailCallback = (result: TruncateFailCallbackResult) => void + /** 接口调用成功的回调函数 */ + type TruncateSuccessCallback = (res: GeneralCallbackResult) => void type UDPSocketOffCloseCallback = (res: GeneralCallbackResult) => void /** 错误事件的回调函数 */ type UDPSocketOffErrorCallback = ( result: UDPSocketOnErrorCallbackResult ) => void - /** 关闭事件的回调函数 */ type UDPSocketOnCloseCallback = (res: GeneralCallbackResult) => void type UDPSocketOnErrorCallback = ( result: UDPSocketOnErrorCallbackResult @@ -19964,6 +20899,10 @@ wx.writeBLECharacteristicValue({ res: GeneralCallbackResult ) => void /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + type WriteCompleteCallback = (res: GeneralCallbackResult) => void + /** 接口调用失败的回调函数 */ + type WriteFailCallback = (result: WriteFailCallbackResult) => void + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ type WriteFileCompleteCallback = (res: GeneralCallbackResult) => void /** 接口调用失败的回调函数 */ type WriteFileFailCallback = (result: WriteFileFailCallbackResult) => void @@ -19975,6 +20914,8 @@ wx.writeBLECharacteristicValue({ type WriteNdefMessageFailCallback = (res: Nfcrwerror) => void /** 接口调用成功的回调函数 */ type WriteNdefMessageSuccessCallback = (res: Nfcrwerror) => void + /** 接口调用成功的回调函数 */ + type WriteSuccessCallback = (result: WriteSuccessCallbackResult) => void /** 接口调用失败的回调函数 */ type WxGetFileInfoFailCallback = (res: GeneralCallbackResult) => void /** 接口调用成功的回调函数 */ diff --git a/types/wx/lib.wx.page.d.ts b/types/wx/lib.wx.page.d.ts index 1cc37fc..8447688 100644 --- a/types/wx/lib.wx.page.d.ts +++ b/types/wx/lib.wx.page.d.ts @@ -32,7 +32,11 @@ declare namespace WechatMiniprogram.Page { type Options< TData extends DataOption, TCustom extends CustomOption - > = (TCustom & Partial> & Partial) & + > = (TCustom & + Partial> & + Partial & { + options?: Component.ComponentOptions + }) & ThisType> type TrivialInstance = Instance interface Constructor { From a534f9606348e1d576a703645f6dca7c9c61d531 Mon Sep 17 00:00:00 2001 From: SgLy <775150558@qq.com> Date: Fri, 2 Jul 2021 17:25:13 +0800 Subject: [PATCH 059/205] feat: update to baselib 2.18.0 closes #209 --- types/wx/index.d.ts | 100 ++- types/wx/lib.wx.api.d.ts | 1766 +++++++++++++++++++++++++++++++------- 2 files changed, 1573 insertions(+), 293 deletions(-) diff --git a/types/wx/index.d.ts b/types/wx/index.d.ts index db82722..4931da2 100644 --- a/types/wx/index.d.ts +++ b/types/wx/index.d.ts @@ -45,10 +45,69 @@ declare namespace WechatMiniprogram { : P extends { complete: any } ? void : Promise>[0]> + interface Console { + /** [console.debug()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.debug.html) + * + * 向调试面板中打印 debug 日志 */ + debug( + /** 日志内容,可以有任意多个。 */ + ...args: any[] + ): void + /** [console.error()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.error.html) + * + * 向调试面板中打印 error 日志 */ + error( + /** 日志内容,可以有任意多个。 */ + ...args: any[] + ): void + /** [console.group(string label)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.group.html) + * + * 在调试面板中创建一个新的分组。随后输出的内容都会被添加一个缩进,表示该内容属于当前分组。调用 [console.groupEnd](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.groupEnd.html)之后分组结束。 + * + * **注意** + * + * + * 仅在工具中有效,在 vConsole 中为空函数实现。 */ + group( + /** 分组标记,可选。 */ + label?: string + ): void + /** [console.groupEnd()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.groupEnd.html) + * + * 结束由 [console.group](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.group.html) 创建的分组 + * + * **注意** + * + * + * 仅在工具中有效,在 vConsole 中为空函数实现。 */ + groupEnd(): void + /** [console.info()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.info.html) + * + * 向调试面板中打印 info 日志 */ + info( + /** 日志内容,可以有任意多个。 */ + ...args: any[] + ): void + /** [console.log()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.log.html) + * + * 向调试面板中打印 log 日志 */ + log( + /** 日志内容,可以有任意多个。 */ + ...args: any[] + ): void + /** [console.warn()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.warn.html) + * + * 向调试面板中打印 warn 日志 */ + warn( + /** 日志内容,可以有任意多个。 */ + ...args: any[] + ): void + } } -declare const console: WechatMiniprogram.Console -declare const wx: WechatMiniprogram.Wx +declare let console: WechatMiniprogram.Console + +declare let wx: WechatMiniprogram.Wx /** 引入模块。返回模块通过 `module.exports` 或 `exports` 暴露的接口。 */ declare function require( /** 需要引入模块文件相对于当前文件的相对路径,或 npm 模块名,或 npm 模块路径。不支持绝对路径 */ @@ -72,3 +131,40 @@ declare let module: { } /** `module.exports` 的引用 */ declare let exports: any + +/** [clearInterval(number intervalID)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/clearInterval.html) + * + * 取消由 setInterval 设置的定时器。 */ +declare function clearInterval( + /** 要取消的定时器的 ID */ + intervalID: number +): void +/** [clearTimeout(number timeoutID)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/clearTimeout.html) + * + * 取消由 setTimeout 设置的定时器。 */ +declare function clearTimeout( + /** 要取消的定时器的 ID */ + timeoutID: number +): void +/** [number setInterval(function callback, number delay, any rest)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/setInterval.html) + * + * 设定一个定时器。按照指定的周期(以毫秒计)来执行注册的回调函数 */ +declare function setInterval( + /** 回调函数 */ + callback: (...args: any[]) => any, + /** 执行回调函数之间的时间间隔,单位 ms。 */ + delay?: number, + /** param1, param2, ..., paramN 等附加参数,它们会作为参数传递给回调函数。 */ + rest?: any +): number +/** [number setTimeout(function callback, number delay, any rest)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/setTimeout.html) + * + * 设定一个定时器。在定时到期以后执行注册的回调函数 */ +declare function setTimeout( + /** 回调函数 */ + callback: (...args: any[]) => any, + /** 延迟的时间,函数的调用会在该延迟之后发生,单位 ms。 */ + delay?: number, + /** param1, param2, ..., paramN 等附加参数,它们会作为参数传递给回调函数。 */ + rest?: any +): number diff --git a/types/wx/lib.wx.api.d.ts b/types/wx/lib.wx.api.d.ts index f1f7ce3..7fde48f 100644 --- a/types/wx/lib.wx.api.d.ts +++ b/types/wx/lib.wx.api.d.ts @@ -89,6 +89,18 @@ declare namespace WechatMiniprogram { /** 接口调用成功的回调函数 */ success?: AddCustomLayerSuccessCallback } + interface AddFileToFavoritesOption { + /** 要收藏的文件地址,必须为本地路径或临时路径 */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AddFileToFavoritesCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: AddFileToFavoritesFailCallback + /** 自定义文件名,若留空则使用filePath中的文件名 */ + fileName?: string + /** 接口调用成功的回调函数 */ + success?: AddFileToFavoritesSuccessCallback + } interface AddGroundOverlayOption { /** 图片覆盖的经纬度范围 */ bounds: MapBounds @@ -255,6 +267,18 @@ declare namespace WechatMiniprogram { /** 接口调用成功的回调函数 */ success?: AddServiceSuccessCallback } + interface AddVideoToFavoritesOption { + /** 要收藏的视频地址,必须为本地路径或临时路径 */ + videoPath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AddVideoToFavoritesCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: AddVideoToFavoritesFailCallback + /** 接口调用成功的回调函数 */ + success?: AddVideoToFavoritesSuccessCallback + /** 缩略图路径,若留空则使用视频首帧 */ + thumbPath?: string + } /** 广播自定义参数 */ interface AdvertiseReqObj { /** 当前Service是否可连接 */ @@ -1040,7 +1064,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb count?: number /** 接口调用失败的回调函数 */ fail?: ChooseMediaFailCallback - /** 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至 30s 之间 */ + /** 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至 60s 之间。不限制相册。 */ maxDuration?: number /** 文件类型 * @@ -1715,6 +1739,46 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 接口调用成功的回调函数 */ success?: EnableAlertBeforeUnloadSuccessCallback } + /** 文件读取结果。res.entries 是一个对象,key是文件路径,value是一个对象 FileItem ,表示该文件的读取结果。每个 FileItem 包含 data (文件内容) 和 errMsg (错误信息) 属性。 */ + interface EntriesResult { + /** 文件路径 */ + [path: string]: ZipFileItem + } + /** 要读取的压缩包内的文件列表(当传入"all" 时表示读取压缩包内所有文件) */ + interface EntryItem { + /** 压缩包内文件路径 */ + path: string + /** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容 + * + * 可选值: + * - 'ascii': ; + * - 'base64': ; + * - 'binary': ; + * - 'hex': ; + * - 'ucs2': 以小端序读取; + * - 'ucs-2': 以小端序读取; + * - 'utf16le': 以小端序读取; + * - 'utf-16le': 以小端序读取; + * - 'utf-8': ; + * - 'utf8': ; + * - 'latin1': ; */ + encoding?: + | 'ascii' + | 'base64' + | 'binary' + | 'hex' + | 'ucs2' + | 'ucs-2' + | 'utf16le' + | 'utf-16le' + | 'utf-8' + | 'utf8' + | 'latin1' + /** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */ + length?: number + /** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */ + position?: number + } interface ExitFullScreenOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: ExitFullScreenCompleteCallback @@ -1723,6 +1787,14 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb /** 接口调用成功的回调函数 */ success?: ExitFullScreenSuccessCallback } + interface ExitMiniProgramOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ExitMiniProgramCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ExitMiniProgramFailCallback + /** 接口调用成功的回调函数 */ + success?: ExitMiniProgramSuccessCallback + } interface ExitPictureInPictureOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: ExitPictureInPictureCompleteCallback @@ -2129,6 +2201,8 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb complete?: GetCenterLocationCompleteCallback /** 接口调用失败的回调函数 */ fail?: GetCenterLocationFailCallback + /** 图标路径,支持网络路径、本地路径、代码包路径 */ + iconPath?: string /** 接口调用成功的回调函数 */ success?: GetCenterLocationSuccessCallback } @@ -2139,6 +2213,33 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb longitude: number errMsg: string } + interface GetChannelsLiveInfoOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetChannelsLiveInfoCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetChannelsLiveInfoFailCallback + /** 直播 feedId,两个 id 至少要填一个 */ + feedId?: string + /** 视频号 id */ + finderUserName?: string + /** 接口调用成功的回调函数 */ + success?: GetChannelsLiveInfoSuccessCallback + } + interface GetChannelsLiveInfoSuccessCallbackResult { + /** 直播描述 */ + description: string + /** 直播 feedId */ + feedId: string + /** 直播封面 */ + headUrl: string + /** 直播名称 */ + nickname: string + /** 直播 nonceId */ + nonceId: string + /** 直播状态,1未开播,2直播中,3直播结束,4直播准备中 */ + status: number + errMsg: string + } interface GetClipboardDataOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: GetClipboardDataCompleteCallback @@ -2304,6 +2405,14 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb width: number errMsg: string } + interface GetLatestUserKeyOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetLatestUserKeyCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetLatestUserKeyFailCallback + /** 接口调用成功的回调函数 */ + success?: GetLatestUserKeySuccessCallback + } interface GetLocationOption { /** 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度 * @@ -2350,7 +2459,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb errMsg: string } interface GetLogManagerOption { - /** 取值为0/1,取值为0表示是否会把 `App`、`Page` 的生命周期函数和 `wx` 命名空间下的函数调用写入日志,取值为1则不会。默认值是 0 + /** 取值为0/1,取值为0表示会把 `App`、`Page` 的生命周期函数和 `wx` 命名空间下的函数调用写入日志,取值为1则不会。默认值是 0 * * 最低基础库: `2.3.2` */ level?: number @@ -3232,6 +3341,14 @@ innerAudioContext.onError((res) => { /** 接口调用成功的回调函数 */ success?: LoadFontFaceSuccessCallback } + interface LocalInfo { + /** 接收消息的 socket 的地址 */ + address: string + /** 使用的协议族,为 IPv4 或者 IPv6 */ + family: string + /** 端口号 */ + port: number + } interface LoginOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: LoginCompleteCallback @@ -3260,7 +3377,7 @@ innerAudioContext.onError((res) => { fail?: MakeBluetoothPairFailCallback /** 接口调用成功的回调函数 */ success?: MakeBluetoothPairSuccessCallback - /** 超时时间 */ + /** 超时时间,单位ms */ timeout?: number } interface MakePhoneCallOption { @@ -3777,9 +3894,9 @@ innerAudioContext.onError((res) => { * * 最低基础库: `1.2.0` */ horizontalAccuracy: number - /** 纬度,范围为 -90~90,负数表示南纬 */ + /** 纬度,范围为 -90~90,负数表示南纬。使用 gcj02 国测局坐标系 */ latitude: number - /** 经度,范围为 -180~180,负数表示西经 */ + /** 经度,范围为 -180~180,负数表示西经。使用 gcj02 国测局坐标系 */ longitude: number /** 速度,单位 m/s */ speed: number @@ -3879,6 +3996,16 @@ innerAudioContext.onError((res) => { /** 还在实时语音通话中的成员 openId 名单 */ openIdList: string[] } + interface OnVoIPChatStateChangedCallbackResult { + /** 事件码 */ + code: number + /** 附加信息 */ + data: IAnyObject + /** 错误码 */ + errCode: number + /** 调用结果 */ + errMsg: string + } interface OnVoIPVideoMembersChangedCallbackResult { /** 错误码 */ errCode: number @@ -3929,6 +4056,12 @@ innerAudioContext.onError((res) => { /** 由 [wx.addCard](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/card/wx.addCard.html) 的返回对象中的加密 code 通过解密后得到,解密请参照:[code 解码接口](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1499332673_Unm7V) */ code: string } + interface OpenChannelsLiveOption { + /** 直播 feedId,通过 getChannelsLiveInfo 接口获取 */ + feedId: string + /** 直播 nonceId,通过 getChannelsLiveInfo 接口获取 */ + nonceId: string + } interface OpenDocumentOption { /** 文件路径 (本地路径) ,可通过 downloadFile 获得 */ filePath: string @@ -4377,13 +4510,13 @@ innerAudioContext.onError((res) => { /** 被写入的缓存区的对象,即接口入参的 arrayBuffer */ arrayBuffer: ArrayBuffer /** 实际读取的字节数 */ - bytesRead: string + bytesRead: number } interface ReadSuccessCallbackResult { /** 被写入的缓存区的对象,即接口入参的 arrayBuffer */ arrayBuffer: ArrayBuffer /** 实际读取的字节数 */ - bytesRead: string + bytesRead: number errMsg: string } interface ReadSyncOption { @@ -4398,6 +4531,49 @@ innerAudioContext.onError((res) => { /** 文件读取的起始位置,如不传或传 null,则会从当前文件指针的位置读取。如果 position 是正整数,则文件指针位置会保持不变并从 position 读取文件。 */ position?: number } + interface ReadZipEntryOption { + /** 要读取的压缩包内的文件列表(当传入"all" 时表示读取压缩包内所有文件) */ + entries: EntryItem[] + /** 要读取的压缩包的路径 (本地路径) */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ReadZipEntryCompleteCallback + /** 统一指定读取文件的字符编码,只在 entries 值为"all"时有效。如果 entries 值为"all"且不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容 + * + * 可选值: + * - 'ascii': ; + * - 'base64': ; + * - 'binary': ; + * - 'hex': ; + * - 'ucs2': 以小端序读取; + * - 'ucs-2': 以小端序读取; + * - 'utf16le': 以小端序读取; + * - 'utf-16le': 以小端序读取; + * - 'utf-8': ; + * - 'utf8': ; + * - 'latin1': ; */ + encoding?: + | 'ascii' + | 'base64' + | 'binary' + | 'hex' + | 'ucs2' + | 'ucs-2' + | 'utf16le' + | 'utf-16le' + | 'utf-8' + | 'utf8' + | 'latin1' + /** 接口调用失败的回调函数 */ + fail?: ReadZipEntryFailCallback + /** 接口调用成功的回调函数 */ + success?: ReadZipEntrySuccessCallback + } + interface ReadZipEntrySuccessCallbackResult { + /** 文件读取结果。res.entries 是一个对象,key是文件路径,value是一个对象 FileItem ,表示该文件的读取结果。每个 FileItem 包含 data (文件内容) 和 errMsg (错误信息) 属性。 */ + entries: EntriesResult + errMsg: string + } interface ReaddirFailCallbackResult { /** 错误信息 * @@ -4456,7 +4632,7 @@ innerAudioContext.onError((res) => { * - 'wav': wav 格式; * - 'PCM': pcm 格式; */ format?: 'mp3' | 'aac' | 'wav' | 'PCM' - /** 指定帧大小,单位 KB。传入 frameSize 后,每录制指定帧大小的内容后,会回调录制的文件内容,不指定则不会回调。暂仅支持 mp3 格式。 */ + /** 指定帧大小,单位 KB。传入 frameSize 后,每录制指定帧大小的内容后,会回调录制的文件内容,不指定则不会回调。暂仅支持 mp3、pcm 格式。 */ frameSize?: number /** 录音通道数 * @@ -4464,7 +4640,7 @@ innerAudioContext.onError((res) => { * - 1: 1 个通道; * - 2: 2 个通道; */ numberOfChannels?: 1 | 2 - /** 采样率 + /** 采样率(pc不支持) * * 可选值: * - 8000: 8000 采样率; @@ -4538,7 +4714,7 @@ innerAudioContext.onError((res) => { /** 上边界 */ top: number } - /** 消息来源的结构化信息 */ + /** 发送端地址信息 */ interface RemoteInfo { /** 发送消息的 socket 的地址 */ address: string @@ -5142,6 +5318,27 @@ wx.createSelectorQuery() /** 设置是否显示滚动条 */ showScrollbar: boolean } + interface SearchContactsOption { + /** 需要查找的号码,长度>=8位才匹配 */ + phoneNumber: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SearchContactsCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SearchContactsFailCallback + /** 接口调用成功的回调函数 */ + success?: SearchContactsSuccessCallback + } + /** 手机号 */ + interface SearchContactsResult { + /** 联系人姓名 */ + name: string + /** 手机号 */ + phoneNumber: string + } + interface SearchContactsSuccessCallbackOption { + /** 手机号 */ + result: SearchContactsResult[] + } interface SeekBackgroundAudioOption { /** 音乐位置,单位:秒 */ position: number @@ -5311,6 +5508,8 @@ wx.createSelectorQuery() complete?: SetLocMarkerIconCompleteCallback /** 接口调用失败的回调函数 */ fail?: SetLocMarkerIconFailCallback + /** 图标路径,支持网络路径、本地路径、代码包路径 */ + iconPath?: string /** 接口调用成功的回调函数 */ success?: SetLocMarkerIconSuccessCallback } @@ -5471,6 +5670,18 @@ wx.createSelectorQuery() zoom: number errMsg: string } + interface ShareFileMessageOption { + /** 要分享的文件地址,必须为本地路径或临时路径 */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShareFileMessageCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ShareFileMessageFailCallback + /** 自定义文件名,若留空则使用filePath中的文件名 */ + fileName?: string + /** 接口调用成功的回调函数 */ + success?: ShareFileMessageSuccessCallback + } interface ShareToWeRunOption { /** 运动数据列表 */ recordList: WxaSportRecord[] @@ -5481,6 +5692,18 @@ wx.createSelectorQuery() /** 接口调用成功的回调函数 */ success?: ShareToWeRunSuccessCallback } + interface ShareVideoMessageOption { + /** 要分享的视频地址,必须为本地路径或临时路径 */ + videoPath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShareVideoMessageCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ShareVideoMessageFailCallback + /** 接口调用成功的回调函数 */ + success?: ShareVideoMessageSuccessCallback + /** 缩略图路径,若留空则使用视频首帧 */ + thumbPath?: string + } interface ShowActionSheetOption { /** 按钮的文字数组,数组长度最大为 6 */ itemList: string[] @@ -6322,6 +6545,20 @@ wx.getSetting({ * 最低基础库: `2.11.0` */ theme?: 'dark' | 'light' } + interface TCPSocketConnectOption { + /** 套接字要连接的地址 */ + address: string + /** 套接字要连接的端口 */ + port: number + } + interface TCPSocketOnMessageCallbackResult { + /** 接收端地址信息 */ + localInfo: LocalInfo + /** 收到的消息 */ + message: ArrayBuffer + /** 发送端地址信息 */ + remoteInfo: RemoteInfo + } interface TakePhotoOption { /** 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: TakePhotoCompleteCallback @@ -6466,9 +6703,11 @@ wx.getSetting({ errMsg: string } interface UDPSocketOnMessageCallbackResult { + /** 接收端地址信息,2.18.0 起支持 */ + localInfo: LocalInfo /** 收到的消息 */ message: ArrayBuffer - /** 消息来源的结构化信息 */ + /** 发送端地址信息 */ remoteInfo: RemoteInfo } interface UDPSocketSendOption { @@ -7024,6 +7263,13 @@ wx.getSetting({ /** 小程序app内跳转url */ url: string } + /** 文件路径 */ + interface ZipFileItem { + /** 文件内容 */ + data: string | ArrayBuffer + /** 错误信息 */ + errMsg: string + } interface Animation { /** [Object Animation.export()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.export.html) * @@ -9164,64 +9410,6 @@ ctx.draw() * | - | - | * | bad file descriptor | 无效的文件描述符 | */ errCode: number } - interface Console { - /** [console.debug()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.debug.html) - * - * 向调试面板中打印 debug 日志 */ - debug( - /** 日志内容,可以有任意多个。 */ - ...args: any[] - ): void - /** [console.error()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.error.html) - * - * 向调试面板中打印 error 日志 */ - error( - /** 日志内容,可以有任意多个。 */ - ...args: any[] - ): void - /** [console.group(string label)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.group.html) - * - * 在调试面板中创建一个新的分组。随后输出的内容都会被添加一个缩进,表示该内容属于当前分组。调用 [console.groupEnd](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.groupEnd.html)之后分组结束。 - * - * **注意** - * - * - * 仅在工具中有效,在 vConsole 中为空函数实现。 */ - group( - /** 分组标记,可选。 */ - label?: string - ): void - /** [console.groupEnd()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.groupEnd.html) - * - * 结束由 [console.group](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.group.html) 创建的分组 - * - * **注意** - * - * - * 仅在工具中有效,在 vConsole 中为空函数实现。 */ - groupEnd(): void - /** [console.info()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.info.html) - * - * 向调试面板中打印 info 日志 */ - info( - /** 日志内容,可以有任意多个。 */ - ...args: any[] - ): void - /** [console.log()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.log.html) - * - * 向调试面板中打印 log 日志 */ - log( - /** 日志内容,可以有任意多个。 */ - ...args: any[] - ): void - /** [console.warn()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.warn.html) - * - * 向调试面板中打印 warn 日志 */ - warn( - /** 日志内容,可以有任意多个。 */ - ...args: any[] - ): void - } interface DownloadTask { /** [DownloadTask.abort()](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.abort.html) * @@ -9399,19 +9587,19 @@ this.editorCtx.insertImage({ undo(option?: UndoOption): void } interface EntryList { - /** [Array EntryList.getEntries()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/EntryList.getEntries.html) + /** [Array EntryList.getEntries()](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/EntryList.getEntries.html) * * 该方法返回当前列表中的所有性能数据 * * 最低基础库: `2.11.0` */ getEntries(): any[] - /** [Array EntryList.getEntriesByName(string name, string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/EntryList.getEntriesByName.html) + /** [Array EntryList.getEntriesByName(string name, string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/EntryList.getEntriesByName.html) * * 获取当前列表中所有名称为 [name] 且类型为 [entryType] 的性能数据 * * 最低基础库: `2.11.0` */ getEntriesByName(name: string, entryType?: string): any[] - /** [Array EntryList.getEntriesByType(string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/EntryList.getEntriesByType.html) + /** [Array EntryList.getEntriesByType(string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/EntryList.getEntriesByType.html) * * 获取当前列表中所有类型为 [entryType] 的性能数据 * @@ -9466,97 +9654,279 @@ this.editorCtx.insertImage({ } interface FileSystemManager { /** [Array.<string> FileSystemManager.readdirSync(string dirPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdirSync.html) - * - * [FileSystemManager.readdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdir.html) 的同步版本 */ +* +* [FileSystemManager.readdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdir.html) 的同步版本 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.readdir({ + dirPath: `${wx.env.USER_DATA_PATH}/example`, + success(res) { + console.log(res.files) + }, + fail(res) { + console.error(res) + } +}) + +// 同步接口 +try { + const res = fs.readdirSync(`${wx.env.USER_DATA_PATH}/example`) + console.log(res.files) +} catch(e) { + console.error(e) +} +``` */ readdirSync( /** 要读取的目录路径 (本地路径) */ dirPath: string ): string[] /** [FileSystemManager.access(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html) - * - * 判断文件/目录是否存在 */ - access(option: AccessOption): void - /** [FileSystemManager.accessSync(string path)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.accessSync.html) - * - * [FileSystemManager.access](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html) 的同步版本 */ - accessSync( - /** 要判断是否存在的文件/目录路径 (本地路径) */ - path: string - ): void - /** [FileSystemManager.appendFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFile.html) - * - * 在文件结尾追加内容 - * - * 最低基础库: `2.1.0` */ - appendFile(option: AppendFileOption): void - /** [FileSystemManager.appendFileSync(string filePath, string|ArrayBuffer data, string encoding)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFileSync.html) - * - * [FileSystemManager.appendFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFile.html) 的同步版本 - * - * 最低基础库: `2.1.0` */ - appendFileSync( - /** 要追加内容的文件路径 (本地路径) */ - filePath: string, - /** 要追加的文本或二进制数据 */ - data: string | ArrayBuffer, - /** 指定写入文件的字符编码 - * - * 参数 encoding 可选值: - * - 'ascii': ; - * - 'base64': ; - * - 'binary': ; - * - 'hex': ; - * - 'ucs2': 以小端序读取; - * - 'ucs-2': 以小端序读取; - * - 'utf16le': 以小端序读取; - * - 'utf-16le': 以小端序读取; - * - 'utf-8': ; - * - 'utf8': ; - * - 'latin1': ; */ - encoding?: - | 'ascii' - | 'base64' - | 'binary' - | 'hex' - | 'ucs2' - | 'ucs-2' - | 'utf16le' - | 'utf-16le' - | 'utf-8' - | 'utf8' - | 'latin1' - ): void - /** [FileSystemManager.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.close.html) * -* 关闭文件 +* 判断文件/目录是否存在 * * **示例代码** * * * ```js const fs = wx.getFileSystemManager() -// 打开文件 -fs.open({ - filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, - flag: 'a+', +// 判断文件/目录是否存在 +fs.access({ + path: `${wx.env.USER_DATA_PATH}/hello.txt`, success(res) { - // 关闭文件 - fs.close({ - fd: res.fd - }) + // 文件存在 + console.log(res) + }, + fail(res) { + // 文件不存在或其他错误 + console.error(res) } }) -``` + +// 同步接口 +try { + fs.accessSync(`${wx.env.USER_DATA_PATH}/hello.txt`) +} catch(e) { + console.error(e) +} +``` */ + access(option: AccessOption): void + /** [FileSystemManager.accessSync(string path)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.accessSync.html) * -* 最低基础库: `2.16.1` */ - close(option: FileSystemManagerCloseOption): void - /** [FileSystemManager.copyFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html) - * - * 复制文件 */ +* [FileSystemManager.access](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html) 的同步版本 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +// 判断文件/目录是否存在 +fs.access({ + path: `${wx.env.USER_DATA_PATH}/hello.txt`, + success(res) { + // 文件存在 + console.log(res) + }, + fail(res) { + // 文件不存在或其他错误 + console.error(res) + } +}) + +// 同步接口 +try { + fs.accessSync(`${wx.env.USER_DATA_PATH}/hello.txt`) +} catch(e) { + console.error(e) +} +``` */ + accessSync( + /** 要判断是否存在的文件/目录路径 (本地路径) */ + path: string + ): void + /** [FileSystemManager.appendFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFile.html) +* +* 在文件结尾追加内容 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() + +fs.appendFile({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + data: 'some text', + encoding: 'utf8', + success(res) { + console.log(res) + }, + fail(res) { + console.error(res) + } +}) + +// 同步接口 +try { + fs.appendFileSync(`${wx.env.USER_DATA_PATH}/hello.txt`, 'some text', 'utf8') +} catch(e) { + console.error(e) +} +``` +* +* 最低基础库: `2.1.0` */ + appendFile(option: AppendFileOption): void + /** [FileSystemManager.appendFileSync(string filePath, string|ArrayBuffer data, string encoding)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFileSync.html) +* +* [FileSystemManager.appendFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFile.html) 的同步版本 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() + +fs.appendFile({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + data: 'some text', + encoding: 'utf8', + success(res) { + console.log(res) + }, + fail(res) { + console.error(res) + } +}) + +// 同步接口 +try { + fs.appendFileSync(`${wx.env.USER_DATA_PATH}/hello.txt`, 'some text', 'utf8') +} catch(e) { + console.error(e) +} +``` +* +* 最低基础库: `2.1.0` */ + appendFileSync( + /** 要追加内容的文件路径 (本地路径) */ + filePath: string, + /** 要追加的文本或二进制数据 */ + data: string | ArrayBuffer, + /** 指定写入文件的字符编码 + * + * 参数 encoding 可选值: + * - 'ascii': ; + * - 'base64': ; + * - 'binary': ; + * - 'hex': ; + * - 'ucs2': 以小端序读取; + * - 'ucs-2': 以小端序读取; + * - 'utf16le': 以小端序读取; + * - 'utf-16le': 以小端序读取; + * - 'utf-8': ; + * - 'utf8': ; + * - 'latin1': ; */ + encoding?: + | 'ascii' + | 'base64' + | 'binary' + | 'hex' + | 'ucs2' + | 'ucs-2' + | 'utf16le' + | 'utf-16le' + | 'utf-8' + | 'utf8' + | 'latin1' + ): void + /** [FileSystemManager.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.close.html) +* +* 关闭文件 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +// 打开文件 +fs.open({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + flag: 'a+', + success(res) { + // 关闭文件 + fs.close({ + fd: res.fd + }) + } +}) +``` +* +* 最低基础库: `2.16.1` */ + close(option: FileSystemManagerCloseOption): void + /** [FileSystemManager.copyFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html) +* +* 复制文件 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.copyFile({ + srcPath: `${wx.env.USER_DATA_PATH}/hello.txt`, + destPath: `${wx.env.USER_DATA_PATH}/hello_copy.txt` + success(res) { + console.log(res) + }, + fail(res) { + console.error(res) + } +}) + +// 同步接口 +try { + fs.copyFileSync( + `${wx.env.USER_DATA_PATH}/hello.txt`, + `${wx.env.USER_DATA_PATH}/hello_copy.txt` + ) +} catch(e) { + console.error(e) +} +``` */ copyFile(option: CopyFileOption): void /** [FileSystemManager.copyFileSync(string srcPath, string destPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFileSync.html) - * - * [FileSystemManager.copyFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html) 的同步版本 */ +* +* [FileSystemManager.copyFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html) 的同步版本 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.copyFile({ + srcPath: `${wx.env.USER_DATA_PATH}/hello.txt`, + destPath: `${wx.env.USER_DATA_PATH}/hello_copy.txt` + success(res) { + console.log(res) + }, + fail(res) { + console.error(res) + } +}) + +// 同步接口 +try { + fs.copyFileSync( + `${wx.env.USER_DATA_PATH}/hello.txt`, + `${wx.env.USER_DATA_PATH}/hello_copy.txt` + ) +} catch(e) { + console.error(e) +} +``` */ copyFileSync( /** 源文件路径,支持本地路径 */ srcPath: string, @@ -9627,12 +9997,60 @@ fs.open({ * 获取该小程序下已保存的本地缓存文件列表 */ getSavedFileList(option?: FileSystemManagerGetSavedFileListOption): void /** [FileSystemManager.mkdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdir.html) - * - * 创建目录 */ +* +* 创建目录 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.mkdir({ + dirPath: `${wx.env.USER_DATA_PATH}/example`, + recursive: false + success(res) { + console.log(res) + }, + fail(res) { + console.error(res) + } +}) + +// 同步接口 +try { + fs.mkdirSync(`${wx.env.USER_DATA_PATH}/example`, false) +} catch(e) { + console.error(e) +} +``` */ mkdir(option: MkdirOption): void /** [FileSystemManager.mkdirSync(string dirPath, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdirSync.html) - * - * [FileSystemManager.mkdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdir.html) 的同步版本 */ +* +* [FileSystemManager.mkdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdir.html) 的同步版本 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.mkdir({ + dirPath: `${wx.env.USER_DATA_PATH}/example`, + recursive: false + success(res) { + console.log(res) + }, + fail(res) { + console.error(res) + } +}) + +// 同步接口 +try { + fs.mkdirSync(`${wx.env.USER_DATA_PATH}/example`, false) +} catch(e) { + console.error(e) +} +``` */ mkdirSync( /** 创建的目录路径 (本地路径) */ dirPath: string, @@ -9692,24 +10110,193 @@ fs.open({ * 最低基础库: `2.16.1` */ read(option: ReadOption): void /** [FileSystemManager.readFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html) - * - * 读取本地文件内容 */ +* +* 读取本地文件内容 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.readFile({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + encoding: 'utf8', + position: 0, + success(res) { + console.log(res.data) + }, + fail(res) { + console.error(res) + } +}) + +// 同步接口 +try { + const res = fs.readFileSync(`${wx.env.USER_DATA_PATH}/hello.txt`, 'utf8', 0) + console.log(res.data) +} catch(e) { + console.error(e) +} +``` */ readFile(option: ReadFileOption): void + /** [FileSystemManager.readZipEntry(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readZipEntry.html) +* +* 读取压缩包内的文件 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +// 读取zip内某个或多个文件 +fs.readZipEntry({ + filePath: 'wxfile://from/to.zip', + entries: [{ + path: 'some_folder/my_file.txt', // zip内文件路径 + encoding: 'utf-8', // 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容 + position: 0, // 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte + length: 10000, // 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte + }, { + path: 'other_folder/orther_file.txt', // zip内文件路径 + }], + success(res) { + console.log(res.entries) + // res.entries === { + // 'some_folder/my_file.txt': { + // errMsg: 'readZipEntry:ok', + // data: 'xxxxxx' + // }, + // 'other_folder/orther_file.txt': { + // data: (ArrayBuffer) + // } + // } + }, + fail(res) { + console.log(res.errMsg) + }, +}) + +// 读取zip内所有文件。允许指定统一的encoding。position、length则不再允许指定,分别默认为0和文件长度 +fs.readZipEntry({ + filePath: 'wxfile://from/to.zip', + entries: 'all' + encoding: 'utf-8', // 统一指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容 + success(res) { + console.log(res.entries) + // res.entries === { + // 'some_folder/my_file.txt': { + // errMsg: 'readZipEntry:ok', + // data: 'xxxxxx' + // }, + // 'other_folder/orther_file.txt': { + // errMsg: 'readZipEntry:ok', + // data: 'xxxxxx' + // } + // } + }, + fail(res) { + console.log(res.errMsg) + }, +}) +``` +* +* 最低基础库: `2.17.3` */ + readZipEntry(option: ReadZipEntryOption): void /** [FileSystemManager.readdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdir.html) - * - * 读取目录内文件列表 */ +* +* 读取目录内文件列表 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.readdir({ + dirPath: `${wx.env.USER_DATA_PATH}/example`, + success(res) { + console.log(res.files) + }, + fail(res) { + console.error(res) + } +}) + +// 同步接口 +try { + const res = fs.readdirSync(`${wx.env.USER_DATA_PATH}/example`) + console.log(res.files) +} catch(e) { + console.error(e) +} +``` */ readdir(option: ReaddirOption): void /** [FileSystemManager.removeSavedFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.removeSavedFile.html) * * 删除该小程序下已保存的本地缓存文件 */ removeSavedFile(option: FileSystemManagerRemoveSavedFileOption): void /** [FileSystemManager.rename(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rename.html) - * - * 重命名文件。可以把文件从 oldPath 移动到 newPath */ +* +* 重命名文件。可以把文件从 oldPath 移动到 newPath +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.rename({ + oldPath: `${wx.env.USER_DATA_PATH}/hello.txt`, + newPath: `${wx.env.USER_DATA_PATH}/hello_new.txt`, + success(res) { + console.log(res) + }, + fail(res) { + console.error(res) + } +}) + +// 同步接口 +try { + const res = fs.renameSync( + `${wx.env.USER_DATA_PATH}/hello.txt`, + `${wx.env.USER_DATA_PATH}/hello_new.txt` + ) + console.log(res) +} catch(e) { + console.error(e) +} +``` */ rename(option: RenameOption): void /** [FileSystemManager.renameSync(string oldPath, string newPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.renameSync.html) - * - * [FileSystemManager.rename](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rename.html) 的同步版本 */ +* +* [FileSystemManager.rename](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rename.html) 的同步版本 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.rename({ + oldPath: `${wx.env.USER_DATA_PATH}/hello.txt`, + newPath: `${wx.env.USER_DATA_PATH}/hello_new.txt`, + success(res) { + console.log(res) + }, + fail(res) { + console.error(res) + } +}) + +// 同步接口 +try { + const res = fs.renameSync( + `${wx.env.USER_DATA_PATH}/hello.txt`, + `${wx.env.USER_DATA_PATH}/hello_new.txt` + ) + console.log(res) +} catch(e) { + console.error(e) +} +``` */ renameSync( /** 源文件路径,支持本地路径 */ oldPath: string, @@ -9717,12 +10304,62 @@ fs.open({ newPath: string ): void /** [FileSystemManager.rmdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdir.html) - * - * 删除目录 */ +* +* 删除目录 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.rmdir({ + dirPath: `${wx.env.USER_DATA_PATH}/example`, + recursive: false, + success(res) { + console.log(res) + }, + fail(res) { + console.error(res) + } +}) + +// 同步接口 +try { + const res = fs.rmdirSync(`${wx.env.USER_DATA_PATH}/example`, false) + console.log(res) +} catch(e) { + console.error(e) +} +``` */ rmdir(option: RmdirOption): void /** [FileSystemManager.rmdirSync(string dirPath, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdirSync.html) - * - * [FileSystemManager.rmdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdir.html) 的同步版本 */ +* +* [FileSystemManager.rmdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdir.html) 的同步版本 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.rmdir({ + dirPath: `${wx.env.USER_DATA_PATH}/example`, + recursive: false, + success(res) { + console.log(res) + }, + fail(res) { + console.error(res) + } +}) + +// 同步接口 +try { + const res = fs.rmdirSync(`${wx.env.USER_DATA_PATH}/example`, false) + console.log(res) +} catch(e) { + console.error(e) +} +``` */ rmdirSync( /** 要删除的目录路径 (本地路径) */ dirPath: string, @@ -9760,19 +10397,84 @@ fs.truncate({ * 最低基础库: `2.16.1` */ truncate(option: TruncateOption): void /** [FileSystemManager.unlink(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlink.html) - * - * 删除文件 */ +* +* 删除文件 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.unlink({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + success(res) { + console.log(res) + }, + fail(res) { + console.error(res) + } +}) + +// 同步接口 +try { + const res = fs.unlinkSync(`${wx.env.USER_DATA_PATH}/hello.txt`) + console.log(res) +} catch(e) { + console.error(e) +} +``` */ unlink(option: UnlinkOption): void /** [FileSystemManager.unlinkSync(string filePath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlinkSync.html) - * - * [FileSystemManager.unlink](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlink.html) 的同步版本 */ +* +* [FileSystemManager.unlink](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlink.html) 的同步版本 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.unlink({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + success(res) { + console.log(res) + }, + fail(res) { + console.error(res) + } +}) + +// 同步接口 +try { + const res = fs.unlinkSync(`${wx.env.USER_DATA_PATH}/hello.txt`) + console.log(res) +} catch(e) { + console.error(e) +} +``` */ unlinkSync( /** 要删除的文件路径 (本地路径) */ filePath: string ): void /** [FileSystemManager.unzip(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unzip.html) - * - * 解压文件 */ +* +* 解压文件 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.unzip({ + zipFilePath: `${wx.env.USER_DATA_PATH}/example.zip`, + targetPath: '${wx.env.USER_DATA_PATH}/example', + success(res) { + console.log(res) + }, + fail(res) { + console.error(res) + } +}) +``` */ unzip(option: UnzipOption): void /** [FileSystemManager.write(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.write.html) * @@ -9803,12 +10505,72 @@ fs.open({ * 最低基础库: `2.16.1` */ write(option: WriteOption): void /** [FileSystemManager.writeFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFile.html) - * - * 写文件 */ +* +* 写文件 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.writeFile({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + data: 'some text or arrayBuffer', + encoding: 'utf8', + success(res) { + console.log(res) + }, + fail(res) { + console.error(res) + } +}) + +// 同步接口 +try { + const res = fs.writeFileSync( + `${wx.env.USER_DATA_PATH}/hello.txt`, + 'some text or arrayBuffer', + 'utf8' + ) + console.log(res) +} catch(e) { + console.error(e) +} +``` */ writeFile(option: WriteFileOption): void /** [FileSystemManager.writeFileSync(string filePath, string|ArrayBuffer data, string encoding)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFileSync.html) - * - * [FileSystemManager.writeFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFile.html) 的同步版本 */ +* +* [FileSystemManager.writeFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFile.html) 的同步版本 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.writeFile({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + data: 'some text or arrayBuffer', + encoding: 'utf8', + success(res) { + console.log(res) + }, + fail(res) { + console.error(res) + } +}) + +// 同步接口 +try { + const res = fs.writeFileSync( + `${wx.env.USER_DATA_PATH}/hello.txt`, + 'some text or arrayBuffer', + 'utf8' + ) + console.log(res) +} catch(e) { + console.error(e) +} +``` */ writeFileSync( /** 要写入的文件路径 (本地路径) */ filePath: string, @@ -9945,8 +10707,34 @@ console.log(fd) filePath?: string ): string /** [string|ArrayBuffer FileSystemManager.readFileSync(string filePath, string encoding, number position, number length)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFileSync.html) - * - * [FileSystemManager.readFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html) 的同步版本 */ +* +* [FileSystemManager.readFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html) 的同步版本 +* +* **示例代码** +* +* +* ```js +const fs = wx.getFileSystemManager() +fs.readFile({ + filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, + encoding: 'utf8', + position: 0, + success(res) { + console.log(res.data) + }, + fail(res) { + console.error(res) + } +}) + +// 同步接口 +try { + const res = fs.readFileSync(`${wx.env.USER_DATA_PATH}/hello.txt`, 'utf8', 0) + console.log(res.data) +} catch(e) { + console.error(e) +} +``` */ readFileSync( /** 要读取的文件的路径 (本地路径) */ filePath: string, @@ -10697,7 +11485,7 @@ Page({ /** [MapContext.getCenterLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getCenterLocation.html) * * 获取当前地图中心的经纬度。返回的是 gcj02 坐标系,可以用于 [wx.openLocation()](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.openLocation.html) */ - getCenterLocation(option?: GetCenterLocationOption): void + getCenterLocation(option: GetCenterLocationOption): void /** [MapContext.getRegion(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getRegion.html) * * 获取当前地图的视野范围 @@ -10834,7 +11622,7 @@ Page({ * 设置定位点图标,支持网络路径、本地路径、代码包路径 * * 最低基础库: `2.16.0` */ - setLocMarkerIcon(option?: SetLocMarkerIconOption): void + setLocMarkerIcon(option: SetLocMarkerIconOption): void /** [MapContext.toScreenLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.toScreenLocation.html) * * 获取经纬度对应的屏幕坐标,坐标原点为地图左上角。 @@ -10965,8 +11753,11 @@ Page({ * * 参数 eventName 可选值: * - 'start': 录制开始事件。; - * - 'stop': 录制结束事件。返回 {tempFilePath, duration, fileSize}; */ - eventName: 'start' | 'stop', + * - 'stop': 录制结束事件。返回 {tempFilePath, duration, fileSize}; + * - 'pause': 录制暂停事件。; + * - 'resume': 录制继续事件。; + * - 'timeupdate': 录制时间更新事件。; */ + eventName: 'start' | 'stop' | 'pause' | 'resume' | 'timeupdate', /** 事件触发时执行的回调函数 */ callback: (...args: any[]) => any ): void @@ -11634,31 +12425,31 @@ Page({ * | fail no such file or directory "${filePath}" | 上级目录不存在 | */ errCode: number } interface Performance { - /** [Array Performance.getEntries()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.getEntries.html) + /** [Array Performance.getEntries()](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.getEntries.html) * * 该方法返回当前缓冲区中的所有性能数据 * * 最低基础库: `2.11.0` */ getEntries(): any[] - /** [Array Performance.getEntriesByName(string name, string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.getEntriesByName.html) + /** [Array Performance.getEntriesByName(string name, string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.getEntriesByName.html) * * 获取当前缓冲区中所有名称为 [name] 且类型为 [entryType] 的性能数据 * * 最低基础库: `2.11.0` */ getEntriesByName(name: string, entryType?: string): any[] - /** [Array Performance.getEntriesByType(string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.getEntriesByType.html) + /** [Array Performance.getEntriesByType(string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.getEntriesByType.html) * * 获取当前缓冲区中所有类型为 [entryType] 的性能数据 * * 最低基础库: `2.11.0` */ getEntriesByType(entryType: string): any[] - /** [Performance.setBufferSize(number size)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.setBufferSize.html) + /** [Performance.setBufferSize(number size)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.setBufferSize.html) * * 设置缓冲区大小, 默认缓冲 30 条性能数据 * * 最低基础库: `2.11.0` */ setBufferSize(size: number): void - /** [[PerformanceObserver](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/PerformanceObserver.html) Performance.createObserver(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.createObserver.html) + /** [[PerformanceObserver](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceObserver.html) Performance.createObserver(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.createObserver.html) * * 创建全局性能事件监听器 * @@ -11666,13 +12457,13 @@ Page({ createObserver(callback: (...args: any[]) => any): PerformanceObserver } interface PerformanceObserver { - /** [PerformanceObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/PerformanceObserver.disconnect.html) + /** [PerformanceObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceObserver.disconnect.html) * * 停止监听 * * 最低基础库: `2.11.0` */ disconnect(): void - /** [PerformanceObserver.observe(Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/PerformanceObserver.observe.html) + /** [PerformanceObserver.observe(Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceObserver.observe.html) * * 开始监听 * @@ -12158,6 +12949,79 @@ Component({ * 判断当前文件是否一个普通文件 */ isFile(): boolean } + interface TCPSocket { + /** [TCPSocket.close()](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.close.html) + * + * 关闭连接 */ + close(): void + /** [TCPSocket.connect(Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.connect.html) + * + * 在给定的套接字上启动连接 */ + connect(options: TCPSocketConnectOption): void + /** [TCPSocket.offClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offClose.html) + * + * 取消监听一旦 socket 完全关闭就发出该事件 */ + offClose( + /** 一旦 socket 完全关闭就发出该事件的回调函数 */ + callback?: UDPSocketOffCloseCallback + ): void + /** [TCPSocket.offConnect(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offConnect.html) + * + * 取消监听当一个 socket 连接成功建立的时候触发该事件 */ + offConnect( + /** 当一个 socket 连接成功建立的时候触发该事件的回调函数 */ + callback?: OffConnectCallback + ): void + /** [TCPSocket.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offError.html) + * + * 取消监听当错误发生时触发 */ + offError( + /** 的回调函数 */ + callback?: UDPSocketOffErrorCallback + ): void + /** [TCPSocket.offMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offMessage.html) + * + * 取消监听当接收到数据的时触发该事件 */ + offMessage( + /** 当接收到数据的时触发该事件的回调函数 */ + callback?: TCPSocketOffMessageCallback + ): void + /** [TCPSocket.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onClose.html) + * + * 监听一旦 socket 完全关闭就发出该事件 */ + onClose( + /** 一旦 socket 完全关闭就发出该事件的回调函数 */ + callback: UDPSocketOnCloseCallback + ): void + /** [TCPSocket.onConnect(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onConnect.html) + * + * 监听当一个 socket 连接成功建立的时候触发该事件 */ + onConnect( + /** 当一个 socket 连接成功建立的时候触发该事件的回调函数 */ + callback: OnConnectCallback + ): void + /** [TCPSocket.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onError.html) + * + * 监听当错误发生时触发 */ + onError( + /** 的回调函数 */ + callback: UDPSocketOnErrorCallback + ): void + /** [TCPSocket.onMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onMessage.html) + * + * 监听当接收到数据的时触发该事件 */ + onMessage( + /** 当接收到数据的时触发该事件的回调函数 */ + callback: TCPSocketOnMessageCallback + ): void + /** [TCPSocket.write(String | ArrayBuffer data)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.write.html) + * + * 在 socket 上发送数据 */ + write( + /** 要发送的数据 */ + data: string | ArrayBuffer + ): void + } interface TruncateSyncError { /** 错误信息 * @@ -12215,7 +13079,7 @@ Component({ * 取消监听收到消息的事件 */ offMessage( /** 收到消息的事件的回调函数 */ - callback?: OffMessageCallback + callback?: UDPSocketOffMessageCallback ): void /** [UDPSocket.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onClose.html) * @@ -12249,6 +13113,15 @@ Component({ * * 向指定的 IP 和 port 发送消息 */ send(option: UDPSocketSendOption): void + /** [UDPSocket.setTTL(number ttl)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.setTTL.html) + * + * 设置 IP_TTL 套接字选项,用于设置一个 IP 数据包传输时允许的最大跳步数 + * + * 最低基础库: `2.18.0` */ + setTTL( + /** ttl 参数可以是 0 到 255 之间 */ + ttl: number + ): void /** [UDPSocket.write()](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.write.html) * * 用法与 send 方法相同,如果没有预先调用 connect 则与 send 无差异(注意即使调用了 connect 也需要在本接口填入地址和端口参数) @@ -12268,25 +13141,45 @@ Component({ interface UpdateManager { /** [UpdateManager.applyUpdate()](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.applyUpdate.html) * - * 强制小程序重启并使用新版本。在小程序新版本下载完成后(即收到 `onUpdateReady` 回调)调用。 */ + * 强制小程序重启并使用新版本。在小程序新版本下载完成后(即收到 `onUpdateReady` 回调)调用。 + * + * **示例代码** + * + * + * [示例代码]((UpdateManager#示例代码)) */ applyUpdate(): void /** [UpdateManager.onCheckForUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onCheckForUpdate.html) * - * 监听向微信后台请求检查更新结果事件。微信在小程序冷启动时自动检查更新,不需由开发者主动触发。 */ + * 监听向微信后台请求检查更新结果事件。微信在小程序冷启动时自动检查更新,不需由开发者主动触发。 + * + * **示例代码** + * + * + * [示例代码]((UpdateManager#示例代码)) */ onCheckForUpdate( /** 向微信后台请求检查更新结果事件的回调函数 */ callback: OnCheckForUpdateCallback ): void /** [UpdateManager.onUpdateFailed(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateFailed.html) * - * 监听小程序更新失败事件。小程序有新版本,客户端主动触发下载(无需开发者触发),下载失败(可能是网络原因等)后回调 */ + * 监听小程序更新失败事件。小程序有新版本,客户端主动触发下载(无需开发者触发),下载失败(可能是网络原因等)后回调 + * + * **示例代码** + * + * + * [示例代码]((UpdateManager#示例代码)) */ onUpdateFailed( /** 小程序更新失败事件的回调函数 */ callback: OnUpdateFailedCallback ): void /** [UpdateManager.onUpdateReady(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateReady.html) * - * 监听小程序有版本更新事件。客户端主动触发下载(无需开发者触发),下载成功后回调 */ + * 监听小程序有版本更新事件。客户端主动触发下载(无需开发者触发),下载成功后回调 + * + * **示例代码** + * + * + * [示例代码]((UpdateManager#示例代码)) */ onUpdateReady( /** 小程序有版本更新事件的回调函数 */ callback: OnUpdateReadyCallback @@ -12336,6 +13229,44 @@ Component({ callback: UploadTaskOnProgressUpdateCallback ): void } + interface UserCryptoManager { + /** [UserCryptoManager.getLatestUserKey(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.getLatestUserKey.html) +* +* 获取最新的用户加密密钥 +* +* **示例代码** +* +* +* ```js +wx.getLatestUserKey({ + success: res => { + const {encryptKey, iv, version, expireTime} = res + console.log(encryptKey, iv, version, expireTime) + } +}) +``` +* +* 最低基础库: `2.17.3` */ + getLatestUserKey(option?: GetLatestUserKeyOption): void + /** [UserCryptoManager.getRandomValues(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.getRandomValues.html) +* +* 获取密码学安全随机数 +* +* **示例代码** +* +* +* ```js +wx.getRandomValues({ + length: 6 // 生成 6 个字节长度的随机数, + success: res => { + console.log(wx.arrayBufferToBase64(res.randomValues)) // 转换为 base64 字符串后打印 + } +}) +``` +* +* 最低基础库: `2.17.3` */ + getRandomValues(option: GetRandomValuesOption): void + } interface VideoContext { /** [VideoContext.exitBackgroundPlayback()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitBackgroundPlayback.html) * @@ -12634,10 +13565,17 @@ console.log(accountInfo.plugin.version) // 插件版本号, 'a.b.c' 这样的 * * 最低基础库: `2.9.4` */ getEnterOptionsSync(): LaunchOptionsApp - /** [Object wx.getExptInfoSync(Array.<string> keys)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/report/wx.getExptInfoSync.html) + /** [Object wx.getExptInfoSync(Array.<string> keys)](https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.getExptInfoSync.html) * * 给定实验参数数组,获取对应的实验参数值 * + * **提示** + * + * + * 假设实验参数有 `color`, `size` + * 调用 wx.getExptInfoSync() 会返回 `{color:'#fff',size:20}` 类似的结果 + * 而 wx.getExptInfoSync(['color']) 则只会返回 `{color:'#fff'}` + * * 最低基础库: `2.14.4` */ getExptInfoSync( /** 实验参数数组,不填则获取所有实验参数 */ @@ -12719,13 +13657,15 @@ try { } ``` */ getStorageInfoSync(): GetStorageInfoSyncOption - /** [Object wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfoSync.html) + /** [Object wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoSync.html) * -* [wx.getSystemInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfo.html) 的同步版本 +* [wx.getSystemInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfo.html) 的同步版本 * * **示例代码** * * +* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/WkUCgXmS7mqO) +* * ```js wx.getSystemInfo({ success (res) { @@ -12849,7 +13789,7 @@ wx.downloadFile({ ): IntersectionObserver /** [[InterstitialAd](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.html) wx.createInterstitialAd(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/wx.createInterstitialAd.html) * - * 创建插屏广告组件。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API。每次调用该方法创建插屏广告都会返回一个全新的实例(小程序端的插屏广告实例不允许跨页面使用)。 + * 创建插屏广告组件。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API。每次调用该方法创建插屏广告都会返回一个全新的实例(小程序端的插屏广告实例不允许跨页面使用)。 * * 最低基础库: `2.6.0` */ createInterstitialAd(option: CreateInterstitialAdOption): InterstitialAd @@ -12919,11 +13859,11 @@ logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3]) }) // 移除播放器音频来源 - mediaAudioPlaye.removeAudioSource(videoDecoder).then() + mediaAudioPlayer.removeAudioSource(videoDecoder).then() // 停止播放器 - mediaAudioPlaye.stop().then() + mediaAudioPlayer.stop().then() // 销毁播放器 - mediaAudioPlaye.destroy().then() + mediaAudioPlayer.destroy().then() // 设置播放器音量 mediaAudioPlayer.volume = 0.5 }) @@ -12943,12 +13883,41 @@ logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3]) * 最低基础库: `2.9.0` */ createMediaContainer(): MediaContainer /** [[MediaRecorder](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.html) wx.createMediaRecorder(Object canvas, Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/wx.createMediaRecorder.html) - * - * 创建 WebGL 画面录制器,可逐帧录制在 WebGL 上渲染的画面并导出视频文件 - * - * 最低基础库: `2.11.0` */ +* +* 创建 WebGL 画面录制器,可逐帧录制在 WebGL 上渲染的画面并导出视频文件 +* +* **示例代码** +* +* +* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/MCz3kPmC7zpa) +* +* **低版本异步接口兼容** +* +* +* 对基础库 2.16.1 版本前的 mediaRecorder,所有的接口都没有返回 Promise 对象,若需要兼容低版本,则可采用如下方式的写法: +* ```javascript +// 启动 mediaRecorder +await new Promise(resolve => { + recorder.on('start', resolve) + recorder.start() +}) + +// 逐帧绘制 +while (frames--) { + await new Promise(resolve => recorder.requestFrame(resolve)) + render() +} + +// 绘制完成,生成视频 +const {tempFilePath} = await new Promise(resolve => { + recorder.on('stop', resolve) + recorder.stop() +}) +``` +* +* 最低基础库: `2.11.0` */ createMediaRecorder( - /** WebGL 对象,通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取到的 node 对象 */ + /** WebGL 对象,通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取到的 node 对象或通过 [wx.createOffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html) 创建的离屏 WebGL Canvas 对象 */ canvas: IAnyObject, options: CreateMediaRecorderOption ): MediaRecorder @@ -13028,7 +13997,7 @@ logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3]) createOffscreenCanvas( option: CreateOffscreenCanvasOption ): OffscreenCanvas - /** [[Performance](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.html) wx.getPerformance()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/wx.getPerformance.html) + /** [[Performance](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.html) wx.getPerformance()](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.getPerformance.html) * * 获取当前小程序性能相关的信息。 * @@ -13048,7 +14017,7 @@ logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3]) * | ---- | ----- | * | entryType | 指标类型 | * | name | 指标名称 | -* | startTime | 指标调用开始时间 | +* | startTime | 指标调用开始时间;appLaunch为点击图标的时间 | * | duration | 耗时 | * | path | 路径 | * | navigationStart | 路由真正响应开始时间 | @@ -13114,7 +14083,7 @@ logger.warn('key3', 'value3') * * ```js wx.request({ - url: 'test.php', //仅为示例,并非真实的接口地址 + url: 'example.php', //仅为示例,并非真实的接口地址 data: { x: '', y: '' @@ -13137,7 +14106,7 @@ wx.request({ ): RequestTask /** [[RewardedVideoAd](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.html) wx.createRewardedVideoAd(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/wx.createRewardedVideoAd.html) * - * 创建激励视频广告组件。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API(小游戏端要求 >= 2.0.4, 小程序端要求 >= 2.6.0)。调用该方法创建的激励视频广告是一个单例(小游戏端是全局单例,小程序端是页面内单例,在小程序端的单例对象不允许跨页面使用)。 + * 创建激励视频广告组件。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API(小游戏端要求 >= 2.0.4, 小程序端要求 >= 2.6.0)。调用该方法创建的激励视频广告是一个单例(小游戏端是全局单例,小程序端是页面内单例,在小程序端的单例对象不允许跨页面使用)。 * * 最低基础库: `2.0.4` */ createRewardedVideoAd( @@ -13164,7 +14133,7 @@ query.exec(function(res){ createSelectorQuery(): SelectorQuery /** [[SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) wx.connectSocket(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.connectSocket.html) * -* 创建一个 WebSocket 连接。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。 +* 创建一个 WebSocket 连接。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。**推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控。同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。** * * **并发数** * @@ -13185,6 +14154,12 @@ wx.connectSocket({ }) ``` */ connectSocket(option: ConnectSocketOption): SocketTask + /** [[TCPSocket](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.html) wx.createTCPSocket()](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/wx.createTCPSocket.html) + * + * 创建一个 TCP Socket 实例。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。 + * + * 最低基础库: `2.18.0` */ + createTCPSocket(): TCPSocket /** [[UDPSocket](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.html) wx.createUDPSocket()](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/wx.createUDPSocket.html) * * 创建一个 UDP Socket 实例。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。 @@ -13195,6 +14170,11 @@ wx.connectSocket({ * * 获取**全局唯一**的版本更新管理器,用于管理小程序更新。关于小程序的更新机制,可以查看[运行机制](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/operating-mechanism.html)文档。 * + * **示例代码** + * + * + * [示例代码]((UpdateManager#示例代码)) + * * 最低基础库: `1.9.90` */ getUpdateManager(): UpdateManager /** [[UploadTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.html) wx.uploadFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/wx.uploadFile.html) @@ -13224,6 +14204,12 @@ wx.chooseImage({ }) ``` */ uploadFile(option: UploadFileOption): UploadTask + /** [[UserCryptoManager](https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.html) wx.getUserCryptoManager()](https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/wx.getUserCryptoManager.html) + * + * 获取用户加密模块 + * + * 最低基础库: `2.17.3` */ + getUserCryptoManager(): UserCryptoManager /** [[VideoContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html) wx.createVideoContext(string id, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.createVideoContext.html) * * 创建 [video](https://developers.weixin.qq.com/miniprogram/dev/component/video.html) 上下文 [VideoContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html) 对象。建议使用 [wx.createSelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html) 获取 context 对象。 */ @@ -13389,6 +14375,16 @@ wx.addCard({ addCard( option: T ): PromisifySuccessResult + /** [wx.addFileToFavorites(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/favorites/wx.addFileToFavorites.html) + * + * 收藏文件 + * + * 最低基础库: `2.16.1` */ + addFileToFavorites< + T extends AddFileToFavoritesOption = AddFileToFavoritesOption + >( + option: T + ): PromisifySuccessResult /** [wx.addPhoneCalendar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneCalendar.html) * * 向系统日历添加事件 @@ -13419,6 +14415,16 @@ wx.addCard({ >( option: T ): PromisifySuccessResult + /** [wx.addVideoToFavorites(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/favorites/wx.addVideoToFavorites.html) + * + * 收藏视频 + * + * 最低基础库: `2.16.1` */ + addVideoToFavorites< + T extends AddVideoToFavoritesOption = AddVideoToFavoritesOption + >( + option: T + ): PromisifySuccessResult /** [wx.authPrivateMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.authPrivateMessage.html) * * 验证私密消息。用法详情见 [小程序私密消息使用指南](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share/private-message.html) @@ -13884,7 +14890,7 @@ wx.closeBluetoothAdapter({ ): PromisifySuccessResult /** [wx.closeSocket(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.closeSocket.html) * -* 关闭 WebSocket 连接 +* 关闭 WebSocket 连接。**推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控。同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。** * * **示例代码** * @@ -14003,6 +15009,25 @@ wx.createBLEConnection({ >( option?: T ): PromisifySuccessResult + /** [wx.createBufferURL(ArrayBuffer|TypedArray buffer)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.createBufferURL.html) + * + * 根据传入的 buffer 创建一个唯一的 URL 存在内存中 + * + * 最低基础库: `2.14.0` */ + createBufferURL( + /** 需要存入内存的二进制数据 */ + buffer: + | ArrayBuffer + | Int8Array + | Uint8Array + | Uint8ClampedArray + | Int16Array + | Uint16Array + | Int32Array + | Uint32Array + | Float32Array + | Float64Array + ): void /** [wx.disableAlertBeforeUnload(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.disableAlertBeforeUnload.html) * * 关闭小程序页面返回询问对话框 @@ -14015,6 +15040,16 @@ wx.createBLEConnection({ * * 最低基础库: `2.12.0` */ enableAlertBeforeUnload(option: EnableAlertBeforeUnloadOption): void + /** [wx.exitMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.exitMiniProgram.html) + * + * 退出当前小程序。必须有点击行为才能调用成功。 + * + * 最低基础库: `2.17.3` */ + exitMiniProgram< + T extends ExitMiniProgramOption = ExitMiniProgramOption + >( + option?: T + ): PromisifySuccessResult /** [wx.exitVoIPChat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.exitVoIPChat.html) * * 退出(销毁)实时语音通话 @@ -14216,6 +15251,12 @@ wx.getBluetoothDevices({ >( option?: T ): PromisifySuccessResult + /** [wx.getChannelsLiveInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.getChannelsLiveInfo.html) + * + * 获取视频号直播信息 + * + * 最低基础库: `2.15.0` */ + getChannelsLiveInfo(option: GetChannelsLiveInfoOption): void /** [wx.getClipboardData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.getClipboardData.html) * * 获取系统剪贴板的内容 @@ -14316,7 +15357,10 @@ wx.getFileInfo({ ): PromisifySuccessResult /** [wx.getGroupEnterInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/group/wx.getGroupEnterInfo.html) * -* 获取群工具小程序启动信息 +* 获取微信群聊场景下的小程序启动信息。群聊场景包括群聊小程序消息卡片、群待办、群工具。可用于获取当前群的 opengid。 +* ## 注意事项 +* - 基础库 v2.10.4 开始支持获取群工具小程序启动信息 +* - 基础库 v2.17.3 开始支持获取群聊小程序消息卡片、群待办小程序启动信息 * * **示例代码** * @@ -14408,7 +15452,7 @@ wx.chooseImage({ ): PromisifySuccessResult /** [wx.getLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html) * -* 获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用。开启高精度定位,接口耗时会增加,可指定 highAccuracyExpireTime 作为超时时间。地图相关使用的坐标格式应为 gcj02。 +* 获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用。开启高精度定位,接口耗时会增加,可指定 highAccuracyExpireTime 作为超时时间。地图相关使用的坐标格式应为 gcj02。高频率调用会导致耗电,如有需要可使用持续定位接口 `wx.onLocationChange`。基础库 `2.17.0` 版本起 `wx.getLocation` 增加调用频率限制,[相关公告](https://developers.weixin.qq.com/community/develop/doc/000aee91a98d206bc6dbe722b51801)。 * * **示例代码** * @@ -14428,6 +15472,7 @@ wx.chooseImage({ * **注意** * * +* - `2.17.0 起 `wx.getLocation` 增加调用频率限制,[相关公告](https://developers.weixin.qq.com/community/develop/doc/000aee91a98d206bc6dbe722b51801) * - 工具中定位模拟使用IP定位,可能会有一定误差。且工具目前仅支持 gcj02 坐标。 * - 使用第三方服务进行逆地址解析时,请确认第三方服务默认的坐标系,正确进行坐标转换。 */ getLocation( @@ -14525,7 +15570,7 @@ wx.getSavedFileList({ >( option?: T ): PromisifySuccessResult - /** [wx.getSelectedTextRange(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/keyboard/wx.getSelectedTextRange.html) + /** [wx.getSelectedTextRange(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.getSelectedTextRange.html) * * 在input、textarea等focus之后,获取输入框的光标位置。注意:只有在focus的时候调用此接口才有效。 * @@ -14599,7 +15644,7 @@ wx.getSetting({ * **示例代码** * * -* 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法)) 。 +* 敏感数据获取方式 [加密数据解密算法]((open-ability/signature#加密数据解密算法)) 。 * 获取得到的开放数据为以下 json 结构(其中 openGId 为当前群的唯一标识): * * ```json @@ -14611,8 +15656,8 @@ wx.getSetting({ * **Tips** * * -* - 如需要展示群名称,小程序可以使用[开放数据组件](https://developers.weixin.qq.com/miniprogram/dev/component/open-data.html) -* - 小游戏可以通过 `wx.getGroupInfo` 接口获取群名称 +* - 如需要展示群名称,小程序可以使用 [开放数据组件](https://developers.weixin.qq.com/miniprogram/dev/component/open-data.html) +* - 小游戏可以通过 [`wx.getGroupInfo`](#) 接口获取群名称 * * 最低基础库: `1.1.0` */ getShareInfo( @@ -14680,13 +15725,15 @@ try { getStorageInfo( option?: T ): PromisifySuccessResult - /** [wx.getSystemInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfo.html) + /** [wx.getSystemInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfo.html) * -* 获取系统信息 +* 获取系统信息。**由于历史原因,wx.getSystemInfo 是异步的调用格式,但是是同步返回,需要异步获取系统信息请使用 [wx.getSystemInfoAsync](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoAsync.html)。** * * **示例代码** * * +* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/WkUCgXmS7mqO) +* * ```js wx.getSystemInfo({ success (res) { @@ -14718,13 +15765,15 @@ try { getSystemInfo( option?: T ): PromisifySuccessResult - /** [wx.getSystemInfoAsync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfoAsync.html) + /** [wx.getSystemInfoAsync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoAsync.html) * * 异步获取系统信息。需要一定的微信客户端版本支持,在不支持的客户端上,会使用同步实现来返回。 * * **示例代码** * * +* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/WkUCgXmS7mqO) +* * ```js wx.getSystemInfoAsync({ success (res) { @@ -14769,7 +15818,9 @@ wx.getUserInfo({ }) ``` * -* 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法)) 。 +* 敏感数据有两种获取方式: +* 1. 使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法)) +* 2. 使用 [云调用直接获取开放数据]((open-ability/signature#云调用直接获取开放数据)) * 获取得到的开放数据为以下 json 结构: * * ```json @@ -14843,7 +15894,8 @@ Page({ * * 1. `tip`:仅小程序中 `wx.getUserInfo` 接口进行调整,小游戏中不受影响; * 2. `tip`:开发者工具中仅 2.10.4 及以上版本可访问 `wx.getUserProfile` 接口,在真机上可参考示例代码进行判断,无需根据版本号或者 `canIUse` 进行条件。 -* 3. `tip`:`wx.getUserprofile` 返回的加密数据中不包含 `openId` 和 `unionId` 字段。 +* 3. `tip`:`wx.getUserProfile` 返回的加密数据中不包含 `openId` 和 `unionId` 字段。 +* 4. `bug`:开发者工具中 `2.10.4`~`2.16.1` 基础库版本通过 `