mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 04:01:52 +00:00
Update comments
This commit is contained in:
Vendored
+170
-70
@@ -4,66 +4,96 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace wx {
|
||||
/**
|
||||
* 微信配置对象
|
||||
*/
|
||||
interface wxconfig {
|
||||
// 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
||||
/**
|
||||
* 开启调试模式,调用的所有 api 的返回值会在客户端 alert 出来,若要查看传入的参数,可以在 pc 端打开,参数信息会通过 log 打出,仅在 pc 端时才会打印。
|
||||
*/
|
||||
debug?: boolean;
|
||||
|
||||
// 公众号的唯一标识
|
||||
/**
|
||||
* 公众号的唯一标识
|
||||
*/
|
||||
appId: string;
|
||||
|
||||
// 签名的时间戳
|
||||
/**
|
||||
* 签名的时间戳
|
||||
*/
|
||||
timestamp: number;
|
||||
|
||||
// 签名的随机串
|
||||
/**
|
||||
* 签名的随机串
|
||||
*/
|
||||
nonceStr: string;
|
||||
|
||||
// 签名
|
||||
/**
|
||||
* 签名
|
||||
*/
|
||||
signature: string;
|
||||
|
||||
// 需要使用的JS接口列表
|
||||
/**
|
||||
* 需要使用的JS接口列表
|
||||
*/
|
||||
jsApiList: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过config接口注入权限验证配置
|
||||
* @param setting 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
||||
* jsApiList[] 需要使用的JS接口列表
|
||||
* 通过 config 接口注入权限验证配置
|
||||
* @param setting 开启调试模式,调用的所有 api 的返回值会在客户端 alert 出来,若要查看传入的参数,可以在 pc 端打开,参数信息会通过 log 打出,仅在 pc 端时才会打印。
|
||||
* jsApiList[] 需要使用的 JS 接口列表
|
||||
*/
|
||||
function config(setting: wxconfig): void;
|
||||
|
||||
/**
|
||||
* config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
|
||||
* config 信息验证后会执行 ready 方法,所有接口调用都必须在 config 接口获得结果之后,config 是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在 ready 函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在 ready 函数中。
|
||||
* @param x
|
||||
*/
|
||||
function ready(x: () => void ): void;
|
||||
|
||||
/**
|
||||
* config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
|
||||
* config 信息验证失败会执行 error 函数,如签名过期导致验证失败,具体错误信息可以打开 config 的 debug 模式查看,也可以在返回的 res 参数中查看,对于 SPA 可以在这里更新签名。
|
||||
*/
|
||||
function error(err: (res: any) => void): void;
|
||||
|
||||
/**
|
||||
* 判断当前客户端版本是否支持指定JS接口,checkJsApi接口是客户端6.0.2新引入的一个预留接口,第一期开放的接口均可不使用checkJsApi来检测
|
||||
* 判断当前客户端版本是否支持指定 JS 接口, checkJsApi 接口是客户端6.0.2新引入的一个预留接口,第一期开放的接口均可不使用 checkJsApi 来检测
|
||||
*/
|
||||
interface CheckApiConfig {
|
||||
// 需要检测的JS接口列表
|
||||
/**
|
||||
* 需要检测的JS接口列表
|
||||
*/
|
||||
jsApiList: string[];
|
||||
|
||||
// 以键值对的形式返回,可用的api值true,不可用为false
|
||||
// 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
|
||||
success(res: {checkResult: {[methodName: string]: boolean}, errMsg: {msg: string}}): void;
|
||||
/**
|
||||
* 以键值对的形式返回,可用的 api 值 true,不可用为 false
|
||||
* 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
|
||||
*/
|
||||
success(res: { checkResult: { [methodName: string]: boolean }, errMsg: { msg: string } }): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前客户端版本是否支持指定JS接口
|
||||
* @param setting
|
||||
* 判断当前客户端版本是否支持指定 JS 接口
|
||||
* @param setting CheckApiConfig 对象
|
||||
*/
|
||||
function checkJsApi(setting: CheckApiConfig): void;
|
||||
|
||||
interface ShareTimelineConfig {
|
||||
title: string; // 分享标题
|
||||
link: string; // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
|
||||
imgUrl?: string; // 分享图标
|
||||
/**
|
||||
* 分享标题
|
||||
*/
|
||||
title: string;
|
||||
|
||||
/**
|
||||
* 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
|
||||
*/
|
||||
link: string;
|
||||
|
||||
/**
|
||||
* 分享图标
|
||||
*/
|
||||
imgUrl?: string;
|
||||
success?(): void;
|
||||
cancel?(): void;
|
||||
}
|
||||
@@ -71,25 +101,42 @@ declare namespace wx {
|
||||
/**
|
||||
* 获取“分享到朋友圈”按钮点击状态及自定义分享内容接口
|
||||
*
|
||||
* @param setting itle分享标题 ,link分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致, imgUrl分享图标, success用户确认分享后执行的回调函数
|
||||
* @param setting ShareTimelineConfig 对象
|
||||
*/
|
||||
function onMenuShareTimeline(setting: ShareTimelineConfig): void;
|
||||
|
||||
/**
|
||||
* 消息分享对象
|
||||
*/
|
||||
interface SharedAppMessage extends ShareTimelineConfig {
|
||||
desc: string; // 分享描述
|
||||
type?: string; // 分享类型,music、video或link,不填默认为link
|
||||
dataUrl?: string; // 如果type是music或video,则要提供数据链接,默认为空
|
||||
/**
|
||||
* 分享描述
|
||||
*/
|
||||
desc: string;
|
||||
|
||||
/**
|
||||
* 分享类型, music、video 或 link,不填默认为 link
|
||||
*/
|
||||
type?: string;
|
||||
|
||||
/**
|
||||
* 如果 type 是 music 或 video,则要提供数据链接,默认为空
|
||||
*/
|
||||
dataUrl?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取“分享给朋友”按钮点击状态及自定义分享内容接口
|
||||
* @param setting title 标题,desc 分享描述,link 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致, imgUrl 分享图标,type 分享类型,music、video或link,不填默认为link
|
||||
* dataUrl如果type是music或video,则要提供数据链接,默认为空, success 用户确认分享后执行的回调函数, cancel 用户取消分享后执行的回调函数
|
||||
* @param setting title 标题,desc 分享描述,link 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致, imgUrl 分享图标,type 分享类型, music、video 或 link,不填默认为 link
|
||||
* dataUrl 如果 type 是 music 或 video,则要提供数据链接,默认为空, success 用户确认分享后执行的回调函数, cancel 用户取消分享后执行的回调函数
|
||||
*/
|
||||
function onMenuShareAppMessage(setting: SharedAppMessage): void;
|
||||
|
||||
interface MenuShareQQ extends ShareTimelineConfig {
|
||||
desc: string; // 分享描述
|
||||
/**
|
||||
* 分享描述
|
||||
*/
|
||||
desc: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,7 +145,10 @@ declare namespace wx {
|
||||
function onMenuShareQQ(config: MenuShareQQ): void;
|
||||
|
||||
interface MenuShareWeibo extends ShareTimelineConfig {
|
||||
desc: string; // 分享描述
|
||||
/**
|
||||
* 分享描述
|
||||
*/
|
||||
desc: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,14 +162,29 @@ declare namespace wx {
|
||||
function onMenuShareQzone(config: MenuShareWeibo): void;
|
||||
|
||||
/**
|
||||
* count默认9, sizeType指定是原图还是压缩图,默认二者都有,sourceType 可以指定来源是相册还是相机,默认二者都有
|
||||
* var localIds = res.localIds; 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
|
||||
* count 默认9, sizeType 指定是原图还是压缩图,默认二者都有,sourceType 可以指定来源是相册还是相机,默认二者都有
|
||||
* var localIds = res.localIds; 返回选定照片的本地ID列表,localId 可以作为 img 标签的 src 属性显示图片
|
||||
*/
|
||||
interface ChooseImageConfig {
|
||||
count?: number; // 默认9
|
||||
sizeType?: string[]; // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType?: string[]; // 可以指定来源是相册还是相机,默认二者都有
|
||||
success(res: { localIds: string[]}): void; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
|
||||
/**
|
||||
* 照片数,默认9
|
||||
*/
|
||||
count?: number;
|
||||
|
||||
/**
|
||||
* 可以指定是原图还是压缩图,默认二者都有
|
||||
*/
|
||||
sizeType?: string[];
|
||||
|
||||
/**
|
||||
* 可以指定来源是相册还是相机,默认二者都有
|
||||
*/
|
||||
sourceType?: string[];
|
||||
|
||||
/**
|
||||
* 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
|
||||
*/
|
||||
success(res: { localIds: string[]}): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,11 +193,17 @@ declare namespace wx {
|
||||
function chooseImage(config: ChooseImageConfig): void;
|
||||
|
||||
/**
|
||||
* current:当前显示图片的http链接, urls:需要预览的图片http链接列表
|
||||
* 显示照片预览用的配置对象
|
||||
*/
|
||||
interface PreviewImageConfig {
|
||||
current: string; // 当前显示图片的http链接
|
||||
urls: string[]; // 需要预览的图片http链接列表
|
||||
/**
|
||||
* 当前显示图片的 http 链接
|
||||
*/
|
||||
current: string;
|
||||
/**
|
||||
* 需要预览的图片 http 链接列表
|
||||
*/
|
||||
urls: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,9 +213,9 @@ declare namespace wx {
|
||||
function previewImage(config: PreviewImageConfig): void;
|
||||
|
||||
/**
|
||||
* localId:要上传的图片的本地ID,由chooseImage接口获得
|
||||
* isShowProgressTips:默认为1,显示进度提示
|
||||
* res: var serverId = res.serverId; 返回图片的服务器端ID
|
||||
* localId:要上传的图片的本地 ID,由 chooseImage 接口获得
|
||||
* isShowProgressTips: 默认为1,显示进度提示
|
||||
* res: var serverId = res.serverId; 返回图片的服务器端 ID
|
||||
*/
|
||||
interface UploadImageConfig {
|
||||
localId: string;
|
||||
@@ -155,8 +226,8 @@ declare namespace wx {
|
||||
function uploadImage(config: UploadImageConfig): void;
|
||||
|
||||
/**
|
||||
* serverId:需要下载的图片的服务器端ID,由uploadImage接口获得
|
||||
* res: var localId = res.localId; 返回图片下载后的本地ID
|
||||
* serverId: 需要下载的图片的服务器端ID,由 uploadImage 接口获得
|
||||
* res: var localId = res.localId; 返回图片下载后的本地 ID
|
||||
*/
|
||||
interface DownLoadImageConfig {
|
||||
serverId: string;
|
||||
@@ -167,7 +238,7 @@ declare namespace wx {
|
||||
function downloadImage(config: DownLoadImageConfig): void;
|
||||
|
||||
/**
|
||||
* locallId: 图片的localID
|
||||
* locallId: 图片的 localID
|
||||
*/
|
||||
interface getLocalImgDataConfig {
|
||||
localId: string;
|
||||
@@ -197,23 +268,23 @@ declare namespace wx {
|
||||
function onVoiceRecordEnd(complete: (res: any) => void): void;
|
||||
|
||||
/**
|
||||
* 需要播放的音频的本地ID,由stopRecord接口获得
|
||||
* 需要播放的音频的本地 ID,由 stopRecord 接口获得
|
||||
* @param localId
|
||||
*/
|
||||
function playVoice(localId: string): void;
|
||||
|
||||
/**
|
||||
* 需要暂停的音频的本地ID,由stopRecord接口获得
|
||||
* 需要暂停的音频的本地 ID,由 stopRecord 接口获得
|
||||
*/
|
||||
function pauseVoice(localId: string): void;
|
||||
|
||||
/**
|
||||
* 需要停止的音频的本地ID,由stopRecord接口获得
|
||||
* 需要停止的音频的本地 ID,由 stopRecord 接口获得
|
||||
*/
|
||||
function stopVoice(localId: string): void;
|
||||
|
||||
/**
|
||||
* res: var localId = res.localId; 返回音频的本地ID
|
||||
* res: var localId = res.localId; 返回音频的本地 ID
|
||||
*/
|
||||
function onVoicePlayEnd(success: (res: any) => void): void;
|
||||
|
||||
@@ -226,12 +297,12 @@ declare namespace wx {
|
||||
/**
|
||||
* 上传语音接口,上传语音有效期3天,可用微信多媒体接口下载语音到自己的服务器,
|
||||
* 此处获得的 serverId 即 media_id,参考文档 .目前多媒体文件下载接口的频率限制为10000次/天,如需要调高频率,请登录微信公众平台,在开发 - 接口权限的列表中,申请提高临时上限。
|
||||
* @param config res: var serverId = res.serverId; 返回音频的服务器端ID
|
||||
* @param config res: var serverId = res.serverId; 返回音频的服务器端 ID
|
||||
*/
|
||||
function uploadVoice(config: UploadVoiceConfig): void;
|
||||
|
||||
/**
|
||||
* serverId:需要下载的音频的服务器端ID,由uploadVoice接口获得
|
||||
* serverId:需要下载的音频的服务器端 ID,由 uploadVoice 接口获得
|
||||
* isShowProgressTips: 默认为1,显示进度提示
|
||||
*/
|
||||
interface downloadVoiceConfig {
|
||||
@@ -249,35 +320,61 @@ declare namespace wx {
|
||||
function translateVoice(config: UploadVoiceConfig): void;
|
||||
|
||||
/**
|
||||
* 获取网络状态, var networkType = res.networkType; // 返回网络类型2g,3g,4g,wifi
|
||||
* 获取网络状态, var networkType = res.networkType; 返回网络类型 2g,3g,4g,wifi
|
||||
*/
|
||||
function getNetworkType(success: (res: { networkType: string }) => void): void;
|
||||
|
||||
interface OpenLocationConfig {
|
||||
latitude?: number;
|
||||
longitude?: number;
|
||||
name?: string; // 位置名
|
||||
address?: string; // 地址详情说明
|
||||
scale?: number; // 地图缩放级别,整形值,范围从1~28。默认为最大
|
||||
infoUrl?: string; // 在查看位置界面底部显示的超链接,可点击跳转
|
||||
|
||||
/**
|
||||
* 位置名
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* 地址详情说明
|
||||
*/
|
||||
address?: string;
|
||||
|
||||
/**
|
||||
* 地图缩放级别,整形值,范围从1~28。默认为最大
|
||||
*/
|
||||
scale?: number;
|
||||
|
||||
/**
|
||||
* 在查看位置界面底部显示的超链接, 可点击跳转
|
||||
*/
|
||||
infoUrl?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信内置地图查看位置接口
|
||||
* @param config name:位置名,scale:地图缩放级别,整形值,范围从1~28。默认为最大
|
||||
* infoUrl: 在查看位置界面底部显示的超链接,可点击跳转
|
||||
* @param config name: 位置名, scale: 地图缩放级别, 整形值, 范围从1~28。默认为最大
|
||||
* infoUrl: 在查看位置界面底部显示的超链接, 可点击跳转
|
||||
*/
|
||||
function openLocation(config: OpenLocationConfig): void;
|
||||
|
||||
interface Location {
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
speed: number; // 速度,以米/每秒计
|
||||
accuracy: number; // 位置精度
|
||||
|
||||
/**
|
||||
* 速度,以米/每秒计
|
||||
*/
|
||||
speed: number;
|
||||
|
||||
/**
|
||||
* 位置精度
|
||||
*/
|
||||
accuracy: number;
|
||||
}
|
||||
|
||||
interface GetLocationConfig {
|
||||
// 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
||||
/**
|
||||
* 默认为 wgs84 的 gps 坐标,如果要返回直接给 openLocation 用的火星坐标,可传入'gcj02'
|
||||
*/
|
||||
type?: string;
|
||||
success(res: Location): void;
|
||||
}
|
||||
@@ -289,7 +386,7 @@ declare namespace wx {
|
||||
function getLocation(config: GetLocationConfig): void;
|
||||
|
||||
/**
|
||||
* ticket:摇周边的业务ticket, 系统自动添加在摇出来的页面链接后面
|
||||
* ticket:摇周边的业务 ticket, 系统自动添加在摇出来的页面链接后面
|
||||
*
|
||||
*/
|
||||
interface StartSearchBeaconsConfig {
|
||||
@@ -298,7 +395,7 @@ declare namespace wx {
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启查找周边ibeacon设备接口
|
||||
* 开启查找周边 ibeacon 设备接口
|
||||
* @param config
|
||||
*/
|
||||
function startSearchBeacons(config: StartSearchBeaconsConfig): void;
|
||||
@@ -316,7 +413,7 @@ declare namespace wx {
|
||||
complete(argv: any): void;
|
||||
}
|
||||
/**
|
||||
* 监听周边ibeacon设备接口,
|
||||
* 监听周边 ibeacon 设备接口,
|
||||
* 摇一摇周边接口使用注意事项及更多返回结果说明,请参考:摇一摇周边获取设备信息
|
||||
*/
|
||||
function onSearchBeacons(config: onSearchBeaconsConfig): void;
|
||||
@@ -327,7 +424,10 @@ declare namespace wx {
|
||||
function closeWindow(): void;
|
||||
|
||||
interface MenuItemsConfig {
|
||||
menuList: string[]; // 要隐藏/显示的菜单项,只能隐藏“传播类”和“保护类”按钮
|
||||
/**
|
||||
* 要隐藏/显示的菜单项,只能隐藏“传播类”和“保护类”按钮
|
||||
*/
|
||||
menuList: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -352,8 +452,8 @@ declare namespace wx {
|
||||
|
||||
/**
|
||||
* needResult: 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
|
||||
* scanType:["qrCode","barCode"],可以指定扫二维码还是一维码,默认二者都有
|
||||
* success: var result = res.resultStr; 当needResult 为 1 时,扫码返回的结果
|
||||
* scanType:["qrCode","barCode"], 可以指定扫二维码还是一维码,默认二者都有
|
||||
* success: var result = res.resultStr; 当 needResult 为 1 时,扫码返回的结果
|
||||
*/
|
||||
interface ScanQRCodeConfig {
|
||||
needResult?: number;
|
||||
@@ -368,7 +468,7 @@ declare namespace wx {
|
||||
|
||||
/**
|
||||
* productId:商品id
|
||||
* viewType: 0.默认值,普通商品详情页1.扫一扫商品详情页2.小店商品详情页
|
||||
* viewType: 0.默认值,普通商品详情页; 1.扫一扫商品详情页; 2.小店商品详情页
|
||||
*/
|
||||
interface OpenProductSpecificViewConfig {
|
||||
productId: string;
|
||||
@@ -414,7 +514,7 @@ declare namespace wx {
|
||||
}
|
||||
|
||||
/**
|
||||
* res: var cardList = res.cardList; 添加的卡券列表信息
|
||||
* res: var cardList = res.cardList; 添加的卡券列表信息
|
||||
*/
|
||||
interface AddCardConfig {
|
||||
cardList: AddCardObj[];
|
||||
@@ -444,9 +544,9 @@ declare namespace wx {
|
||||
function openCard(config: OpenCardConfig): void;
|
||||
|
||||
/**
|
||||
* timestamp: 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
|
||||
* timestamp: 支付签名时间戳,注意微信jssdk中的所有使用 timestamp 字段均为小写。但最新版的支付后台生成签名使用的 timeStamp 字段名需大写其中的S字符
|
||||
* nonceStr: 支付签名随机串,不长于 32 位
|
||||
* package: 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=***
|
||||
* package: 统一支付接口返回的 prepay_id 参数值,提交格式如:prepay_id=***
|
||||
* signType: 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
|
||||
* paySign: 支付签名
|
||||
* success: 支付成功后的回调函数
|
||||
|
||||
@@ -27,6 +27,11 @@ wx.onMenuShareAppMessage({
|
||||
imgUrl: ''
|
||||
});
|
||||
|
||||
wx.onMenuShareTimeline({
|
||||
title: '',
|
||||
link: ''
|
||||
});
|
||||
|
||||
wx.scanQRCode({
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user