@uni-helper/uni-promises
Version:
uni-app Promise 化的 API
1,101 lines (966 loc) • 44.2 kB
TypeScript
interface TaskPromise<T = UniApp.GeneralCallbackResult> extends Promise<T> {
abort: () => void;
onHeadersReceived: (callback: (result: {
header: Record<string, any>;
}) => void) => void;
offHeadersReceived: (callback: (result: {
header: Record<string, any>;
}) => void) => void;
}
interface RequestPromise<T = UniApp.RequestSuccessCallbackResult> extends TaskPromise<T> {
onChunkReceived: (callback: (result: {
data: ArrayBuffer;
}) => void) => void;
offChunkReceived: (callback?: (result: {
data: ArrayBuffer;
}) => void) => void;
}
interface DownloadFilePromise<T = UniApp.DownloadSuccessData> extends TaskPromise<T> {
onProgressUpdate: (callback: (result: {
progress: number;
totalBytesWritten: number;
totalBytesExpectedToWrite: number;
}) => void) => void;
offProgressUpdate: (callback: (result: {
progress: number;
totalBytesWritten: number;
totalBytesExpectedToWrite: number;
}) => void) => void;
}
interface UploadFilePromise<T = UniApp.UploadFileSuccessCallbackResult> extends TaskPromise<T> {
onProgressUpdate: (callback: (result: {
progress: number;
totalBytesSent: number;
totalBytesExpectedToSend: number;
}) => void) => void;
offProgressUpdate: (callback: (result: {
progress: number;
totalBytesSent: number;
totalBytesExpectedToSend: number;
}) => void) => void;
}
declare function noop(): void;
declare function promisify<F extends (...args: any) => void>(callback: F): (...args: Parameters<F>) => Promise<Parameters<NonNullable<NonNullable<Parameters<F>[0]>["success"]>>[0]>;
declare function mountTaskMethodToPromise<T = UniApp.GeneralCallbackResult>(task?: UniApp.RequestTask | UniApp.UploadTask | UniApp.DownloadTask, promise?: RequestPromise<T> | DownloadFilePromise<T> | UploadFilePromise<T>): void;
/**
* 增加手机通讯录联系人和联系方式
*
* 文档 http://uniapp.dcloud.io/api/system/contact?id=addphonecontact
*/
declare const addPhoneContact: (options?: UniApp.AddPhoneContactOptions | undefined) => Promise<any>;
/**
* 提前向用户发起授权请求
*
* 文档 http://uniapp.dcloud.io/api/other/authorize?id=authorize
*/
declare const authorize: (options: UniApp.AuthorizeOptions) => Promise<any>;
/**
* 获取设备内是否录入指纹等生物信息
*
* 文档 http://uniapp.dcloud.io/api/system/authentication?id=checkissoterenrolledindevice
*/
declare const checkIsSoterEnrolledInDevice: (options: UniApp.CheckIsSoterEnrolledInDeviceOptions) => Promise<UniApp.CheckIsSoterEnrolledInDeviceRes>;
/**
* 获取本机支持的 SOTER 生物认证方式
*
* 文档 http://uniapp.dcloud.io/api/system/authentication?id=checkissupportsoterauthentication
*/
declare const checkIsSupportSoterAuthentication: (options?: UniApp.CheckIsSupportSoterAuthenticationOptions | undefined) => Promise<UniApp.CheckIsSupportSoterAuthenticationRes>;
/**
* 登录
*
* 文档 http://uniapp.dcloud.io/api/plugins/login?id=unichecksession
*/
declare const checkSession: (options?: UniApp.CheckSessionOptions | undefined) => Promise<any>;
/**
* 获取用户收货地址
*
* 调起用户编辑收货地址原生界面,并在编辑完成后返回用户选择的地址,需要用户授权 scope.address
*
* 文档 http://uniapp.dcloud.io/api/other/choose-address?id=chooseaddress
*/
declare const chooseAddress: (options?: UniApp.ChooseAddressOptions | undefined) => Promise<UniApp.ChooseAddressRes>;
/**
* 从本地选择文件
*
* 仅支持H5
*
* 文档 http://uniapp.dcloud.io/api/media/file?id=chooseFile
*/
declare const chooseFile: (options?: UniApp.ChooseFileOptions | undefined) => Promise<UniApp.ChooseFileSuccessCallbackResult>;
/**
* 从本地相册选择图片或使用相机拍照
*
* 文档 http://uniapp.dcloud.io/api/media/image?id=chooseimage
*/
declare const chooseImage: (options?: UniApp.ChooseImageOptions | undefined) => Promise<UniApp.ChooseImageSuccessCallbackResult>;
/**
* 需要基础库: `2.3.0`
*
* 在插件中使用:需要基础库 `2.16.1`
*
* 选择用户已有的发票。
*
* 通过 cardId 和 encryptCode 获得报销发票的信息。
*
* 请参考 [微信电子发票文档](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=21517918939oae3U)
* 中,「查询报销发票信息」部分。
*
* 其中 `access_token` 的获取请参考
* [auth.getAccessToken](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html)
* 文档
*
* 文档 https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoice.html
*/
declare const chooseInvoice: (option?: UniApp.ChooseInvoiceOption | undefined) => Promise<UniApp.ChooseInvoiceSuccessCallbackResult>;
/**
* 选择用户的发票抬头,需要用户授权 scope.invoiceTitle
*
* 文档 http://uniapp.dcloud.io/api/other/invoice-title?id=chooseinvoicetitle
*/
declare const chooseInvoiceTitle: (options?: UniApp.ChooseInvoiceTitleOptions | undefined) => Promise<UniApp.ChooseInvoiceTitleRes>;
/**
* 打开地图选择位置。
*
* 文档 http://uniapp.dcloud.io/api/location/location?id=chooselocation
*/
declare const chooseLocation: (options?: UniApp.ChooseLocationOptions | undefined) => Promise<UniApp.ChooseLocationSuccess>;
/**
* 需要基础库: `2.10.0`
*
* 在插件中使用:需要基础库 `2.11.1`
*
* 拍摄或从手机相册中选择图片或视频。
*
* 文档 https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html
*/
declare const chooseMedia: (option: UniApp.ChooseMediaOption) => Promise<UniApp.ChooseMediaSuccessCallbackResult>;
/**
* 需要基础库: `2.5.0`
*
* 在插件中使用:不支持
*
* 从客户端会话选择文件。
*
* ```js
* wx.chooseMessageFile({
* count: 10,
* type: 'image',
* success(res) {
* // tempFilePath可以作为img标签的src属性显示图片
* const tempFilePaths = res.tempFiles;
* },
* });
* ```
*
* 文档 https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseMessageFile.html
*/
declare const chooseMessageFile: (option: UniApp.ChooseMessageFileOption) => Promise<UniApp.ChooseMessageFileSuccessCallbackResult>;
/**
* 拍摄视频或从手机相册中选视频,返回视频的临时文件路径。
*
* 文档 http://uniapp.dcloud.io/api/media/video?id=choosevideo
*/
declare const chooseVideo: (options?: UniApp.ChooseVideoOptions | undefined) => Promise<UniApp.ChooseVideoSuccess>;
/**
* 清理本地数据缓存
*
* 文档 http://uniapp.dcloud.io/api/storage/storage?id=clearstorage
*/
declare const clearStorage: () => Promise<never>;
/**
* 断开与低功耗蓝牙设备的连接
*
* 文档 http://uniapp.dcloud.io/api/system/ble?id=closebleconnection
*/
declare const closeBLEConnection: (options: UniApp.CloseBLEConnectionOptions) => Promise<any>;
/**
* 关闭蓝牙模块
*
* 文档 http://uniapp.dcloud.io/api/system/bluetooth?id=closebluetoothadapter
*/
declare const closeBluetoothAdapter: (options?: UniApp.CloseBluetoothAdapterOptions | undefined) => Promise<any>;
/**
* 预览图片
*
* 文档 http://uniapp.dcloud.io/api/media/image?id=closepreviewimage
*/
declare const closePreviewImage: (options?: UniApp.CallBackOptions | undefined) => Promise<UniApp.GeneralCallbackResult>;
/**
* 关闭 WebSocket 连接
*
* 文档 http://uniapp.dcloud.io/api/request/websocket?id=closesocket
*/
declare const closeSocket: () => (options?: UniApp.CloseSocketOptions | undefined) => Promise<UniApp.GeneralCallbackResult>;
/**
* 压缩图片
*
* 文档 http://uniapp.dcloud.io/api/media/image?id=compressimage
*/
declare const compressImage: (options: UniApp.CompressImageOptions) => Promise<UniApp.CompressImageSuccessResult>;
/**
* 压缩视频
*
* 文档 http://uniapp.dcloud.io/api/media/video?id=compressvideo
*/
declare const compressVideo: (options: UniApp.CompressVideoOptions) => Promise<UniApp.CompressVideoSuccessData>;
/**
* 创建一个 WebSocket 连接
*
* 文档 http://uniapp.dcloud.io/api/request/websocket?id=connectsocket
*/
declare const connectSocket: () => (options: UniApp.ConnectSocketOption) => Promise<any>;
/**
* 连接低功耗蓝牙设备
*
* 文档 http://uniapp.dcloud.io/api/system/ble?id=createbleconnection
*/
declare const createBLEConnection: (options: UniApp.CreateBLEConnectionOptions) => Promise<any>;
/**
* 创建并返回 camera 组件的上下文 cameraContext 对象
*
* 文档 http://uniapp.dcloud.io/api/media/camera-context
*/
declare const createCameraContext: () => UniApp.CameraContext;
/**
* 创建 canvas 绘图上下文
*
* 文档 http://uniapp.dcloud.io/api/canvas/createCanvasContext?id=createcanvascontext
*/
declare const createCanvasContext: (canvasId: string, componentInstance?: any) => UniApp.CanvasContext;
/**
* 创建并返回 audio 上下文 audioContext 对象
*
* 文档 http://uniapp.dcloud.io/api/media/audio-context?id=createinneraudiocontext
*/
declare const createInnerAudioContext: () => UniApp.InnerAudioContext;
/**
* 需要基础库: `1.7.0`
*
* 在插件中使用:需要基础库 `1.9.6`
*
* 创建 [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)
* 对象。建议使用
* [uni.createSelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html)
* 获取 context 对象。
*
* 文档
* https://developers.weixin.qq.com/miniprogram/dev/api/media/live/wx.createLivePlayerContext.html
*/
declare const createLivePlayerContext: (livePlayerId: string, componentInstance?: any) => UniApp.LivePlayerContext;
/**
* 创建 live-pusher 上下文 livePusherContext 对象
*
* 文档 http://uniapp.dcloud.io/api/media/camera-context
*/
declare const createLivePusherContext: (livePusherId: string, componentInstance?: any) => UniApp.LivePusherContext;
interface MapContext extends UniApp.MapContext {
/** 获取当前地图中心的经纬度,返回的是 gcj02 坐标系,可以用于 uni.openLocation */
getCenterLocation(options: UniApp.MapContextGetCenterLocationOptions): Promise<Parameters<NonNullable<UniApp.MapContextGetCenterLocationOptions['success']>>[0]>;
/** 将地图中心移动到当前定位点,需要配合 map 组件的 show-location 使用 */
moveToLocation(options: UniApp.MapContextMoveToLocationOptions): Promise<Parameters<NonNullable<UniApp.MapContextMoveToLocationOptions['success']>>[0]>;
/** 平移marker,带动画 */
translateMarker(options: UniApp.MapContextTranslateMarkerOptions): Promise<Parameters<NonNullable<UniApp.MapContextTranslateMarkerOptions['success']>>[0]>;
/** 缩放视野展示所有经纬度 */
includePoints(options: UniApp.MapContextIncludePointsOptions): Promise<Parameters<NonNullable<UniApp.MapContextIncludePointsOptions['success']>>[0]>;
/** 获取当前地图的视野范围 */
getRegion(options: UniApp.MapContextGetRegionOptions): Promise<Parameters<NonNullable<UniApp.MapContextGetRegionOptions['success']>>[0]>;
/** 获取当前地图的缩放级别 */
getScale(options: UniApp.MapContextGetScaleOptions): Promise<Parameters<NonNullable<UniApp.MapContextGetScaleOptions['success']>>[0]>;
/** 添加个性化图层 */
addCustomLayer(options: UniApp.MapContextAddCustomLayerOptions): Promise<Parameters<NonNullable<UniApp.MapContextAddCustomLayerOptions['success']>>[0]>;
/** 创建自定义图片图层,图片会随着地图缩放而缩放 */
addGroundOverlay(options: UniApp.MapContextAddGroundOverlayOptions): Promise<Parameters<NonNullable<UniApp.MapContextAddGroundOverlayOptions['success']>>[0]>;
/** 添加 marker */
addMarkers(options: UniApp.MapContextAddMarkersOptions): Promise<Parameters<NonNullable<UniApp.MapContextAddMarkersOptions['success']>>[0]>;
/** 获取屏幕上的点对应的经纬度,坐标原点为地图左上角 */
fromScreenLocation(options: UniApp.MapContextFromScreenLocationOptions): Promise<Parameters<NonNullable<UniApp.MapContextFromScreenLocationOptions['success']>>[0]>;
/** 初始化点聚合的配置,未调用时采用默认配置 */
initMarkerCluster(options: UniApp.MapContextInitMarkerClusterOptions): Promise<Parameters<NonNullable<UniApp.MapContextInitMarkerClusterOptions['success']>>[0]>;
/**
* 沿指定路径移动 marker,用于轨迹回放等场景
*
* 动画完成时触发回调事件,若动画进行中,对同一 marker 再次调用 moveAlong 方法,前一次的动画将被打断
*/
moveAlong(options: UniApp.MapContextMoveAlongOptions): Promise<Parameters<NonNullable<UniApp.MapContextMoveAlongOptions['success']>>[0]>;
/** 拉起地图 APP 选择导航 */
openMapApp(options: UniApp.MapContextOpenMapAppOptions): Promise<Parameters<NonNullable<UniApp.MapContextOpenMapAppOptions['success']>>[0]>;
/** 移除个性化图层 */
removeCustomLayer(options: UniApp.MapContextRemoveCustomLayerOptions): Promise<Parameters<NonNullable<UniApp.MapContextRemoveCustomLayerOptions['success']>>[0]>;
/** 移除自定义图片图层 */
removeGroundOverlay(options: UniApp.MapContextRemoveGroundOverlayOptions): Promise<Parameters<NonNullable<UniApp.MapContextRemoveGroundOverlayOptions['success']>>[0]>;
/** 移除 marker */
removeMarkers(options: UniApp.MapContextRemoveMarkersOptions): Promise<Parameters<NonNullable<UniApp.MapContextRemoveMarkersOptions['success']>>[0]>;
/**
* 设置地图中心点偏移,向后向下为增长,屏幕比例范围(0.25~0.75)
*
* 默认偏移为[0.5, 0.5]
*/
setCenterOffset(options: UniApp.MapContextSetCenterOffsetOptions): Promise<Parameters<NonNullable<UniApp.MapContextSetCenterOffsetOptions['success']>>[0]>;
/** 获取经纬度对应的屏幕坐标,坐标原点为地图左上角 */
toScreenLocation(options: UniApp.MapContextToScreenLocationOptions): Promise<Parameters<NonNullable<UniApp.MapContextToScreenLocationOptions['success']>>[0]>;
/** 更新自定义图片图层 */
updateGroundOverlay(options: UniApp.MapContextUpdateGroundOverlayOptions): Promise<Parameters<NonNullable<UniApp.MapContextUpdateGroundOverlayOptions['success']>>[0]>;
}
declare const createMapContext: (mapId: string, componentInstance?: any) => Promise<MapContext>;
/**
* 需要基础库: `2.9.0`
*
* 在插件中使用:需要基础库 `2.10.0`
*
* 创建音视频处理容器,最终可将容器中的轨道合成一个视频
*
* 文档
* https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/wx.createMediaContainer.html
*/
declare const createMediaContainer: () => UniApp.MediaContainer;
/**
* 创建本地通知栏消息
*
* 文档 http://uniapp.dcloud.io/api/plugins/push.html#createpushmessage
*/
declare const createPushMessage: (options: UniApp.CreatePushMessageOptions) => Promise<any>;
/**
* 返回一个 SelectorQuery 对象实例
*
* 文档 http://uniapp.dcloud.io/api/ui/nodes-info?id=createselectorquery
*/
declare const createSelectorQuery: () => UniApp.SelectorQuery;
/**
* 创建并返回 video 上下文 videoContext 对象
*
* 文档 http://uniapp.dcloud.io/api/media/video-context?id=createvideocontext
*/
declare const createVideoContext: (videoId: string, componentInstance?: any) => UniApp.VideoContext;
/**
* 下载文件
*
* 文档 http://uniapp.dcloud.io/api/request/network-file?id=downloadfile
*/
declare function downloadFile<T = UniApp.DownloadSuccessData>(urlOrOptions: string | UniApp.DownloadFileOption, options?: UniApp.DownloadFileOption): DownloadFilePromise<T>;
declare const _getApp: () => Promise<App.AppInstance<AnyObject> & AnyObject>;
/**
* 获取全局唯一的背景音频管理器 backgroundAudioManager
*
* 文档 http://uniapp.dcloud.io/api/media/background-audio-manager?id=getbackgroundaudiomanager
*/
declare const getBackgroundAudioManager: () => UniApp.BackgroundAudioManager;
/**
* 获取设备电量
*
* 文档 https://uniapp.dcloud.net.cn/api/system/batteryInfo.html
*/
declare const getBatteryInfo: (option?: UniApp.GetBatteryInfoOption | undefined) => Promise<UniApp.GetBatteryInfoSuccessCallbackResult>;
/**
* 获取蓝牙设备指定服务中所有特征值
*
* 文档 http://uniapp.dcloud.io/api/system/ble?id=getbledevicecharacteristics
*/
declare const getBLEDeviceCharacteristics: (options: UniApp.GetBLEDeviceCharacteristicsOptions) => Promise<UniApp.GetBLEDeviceCharacteristicsSuccess>;
/**
* 获取蓝牙设备的信号强度。
*
* 文档 http://uniapp.dcloud.io/api/system/ble?id=getBLEDeviceRSSI
*/
declare const getBLEDeviceRSSI: (options: UniApp.GetBLEDeviceRSSIOptions) => Promise<any>;
/**
* 获取蓝牙设备的所有服务
*
* 文档 http://uniapp.dcloud.io/api/system/ble?id=getbledeviceservices
*/
declare const getBLEDeviceServices: (options: UniApp.GetBLEDeviceServicesOptions) => Promise<UniApp.GetBLEDeviceServicesSuccess>;
/**
* 获取本机蓝牙适配器状态
*
* 文档 http://uniapp.dcloud.io/api/system/bluetooth?id=getbluetoothadapterstate
*/
declare const getBluetoothAdapterState: (options?: UniApp.GetBluetoothAdapterStateOptions | undefined) => Promise<UniApp.GetBluetoothAdapterStateSuccess>;
/**
* 获取已搜索到的蓝牙设备
*
* 文档 http://uniapp.dcloud.io/api/system/bluetooth?id=getbluetoothdevices
*/
declare const getBluetoothDevices: (options?: UniApp.GetBluetoothDevicesOptions | undefined) => Promise<UniApp.GetBluetoothDevicesSuccess>;
/**
* 获取一键登录条款勾选框状态
*
* 文档 http://uniapp.dcloud.io/api/plugins/login?id=getCheckBoxState
*/
declare const getCheckBoxState: (options?: UniApp.GetCheckBoxStateOptions | undefined) => Promise<UniApp.GetCheckBoxStateRes>;
/**
* 获得系统剪贴板的内容
*
* 文档 http://uniapp.dcloud.io/api/system/clipboard?id=getclipboarddata
*/
declare const getClipboardData: (options?: UniApp.GetClipboardDataOptions | undefined) => Promise<UniApp.GetClipboardDataSuccessRes>;
/**
* 根据 uuid 获取处于已连接的设备
*
* 文档 http://uniapp.dcloud.io/api/system/bluetooth?id=getconnectedbluetoothdevices
*/
declare const getConnectedBluetoothDevices: (options: UniApp.GetConnectedBluetoothDevicesOptions) => Promise<UniApp.GetConnectedBluetoothDevicesSuccess>;
/**
* 获取第三方平台自定义的数据字段
*
* 文档 http://uniapp.dcloud.io/api/other/get-extconfig?id=getextconfig
*/
declare const getExtConfig: (options?: UniApp.GetExtConfigOptions | undefined) => Promise<UniApp.GetExtConfigSuccessCallbackResult>;
/**
* 获取文件信息
*
* 文档 https://uniapp.dcloud.net.cn/api/file/file.html#getfileinfo
*/
declare const getFileInfo: (options: UniApp.GetFileInfoOptions) => Promise<UniApp.GetFileInfoSuccess>;
/**
* 预览图片
*
* 文档 http://uniapp.dcloud.io/api/media/image?id=getimageinfo
*/
declare const getImageInfo: (options: UniApp.GetImageInfoOptions) => Promise<UniApp.GetImageInfoSuccessData>;
/**
* 获取当前的地理位置、速度
*
* 文档 http://uniapp.dcloud.io/api/location/location?id=getlocation
*/
declare const getLocation: (options?: UniApp.GetLocationOptions | undefined) => Promise<UniApp.GetLocationSuccess>;
/**
* 获取网络类型
*
* 文档 http://uniapp.dcloud.io/api/system/network?id=getnetworktype
*/
declare const getNetworkType: (options?: UniApp.GetNetworkTypeOptions | undefined) => Promise<UniApp.GetNetworkTypeSuccess>;
/**
* 获取服务供应商
*
* 文档 http://uniapp.dcloud.io/api/plugins/provider?id=getprovider
*/
declare const getProvider: (options: UniApp.GetProviderOptions) => Promise<UniApp.GetProviderRes>;
/**
* 获取客户端唯一的推送标识
*
* 文档 http://uniapp.dcloud.io/api/plugins/push.html#getpushclientid
*/
declare const getPushClientId: (options?: UniApp.GetPushClientIdOptions | undefined) => Promise<UniApp.GetPushClientIdSuccessData>;
/**
* 录音管理
*
* 文档 http://uniapp.dcloud.io/api/media/record-manager?id=getrecordermanager
*/
declare const getRecordManager: () => UniApp.RecorderManager;
/**
* 获取本地文件的文件信息
*
* 文档 http://uniapp.dcloud.io/api/file/file?id=getsavedfileinfo
*/
declare const getSavedFileInfo: (options: UniApp.GetSavedFileInfoOptions) => Promise<UniApp.GetSavedFileInfoSuccess>;
/**
* 获取本地已保存的文件列表
*
* 文档 http://uniapp.dcloud.io/api/file/file?id=getsavedfilelist
*/
declare const getSavedFileList: (options?: UniApp.GetSavedFileListOptions | undefined) => Promise<UniApp.GetSavedFileListSuccess>;
/**
* 获取屏幕亮度
*
* 文档 http://uniapp.dcloud.io/api/system/brightness?id=getscreenbrightness
*/
declare const getScreenBrightness: (options?: UniApp.GetScreenBrightnessOptions | undefined) => Promise<UniApp.GetScreenBrightnessSuccessRes>;
/**
* 获取输入框的光标位置
*
* 文档 http://uniapp.dcloud.io/api/key?id=getselectedtextrange
*/
declare const getSelectedTextRange: (options?: UniApp.GetSelectedTextRangeOptions | undefined) => Promise<UniApp.GetSelectedTextRangeSuccessCallbackResult>;
/**
* 获取用户的当前设置
*
* 文档 http://uniapp.dcloud.io/api/other/setting?id=getsetting
*/
declare const getSetting: (options?: UniApp.GetSettingOptions | undefined) => Promise<UniApp.GetSettingSuccessResult>;
/**
* 从本地缓存中异步获取指定 key 对应的内容
*
* 文档 http://uniapp.dcloud.io/api/storage/storage?id=getstorage
*/
declare const getStorage: (options: UniApp.GetStorageOptions) => Promise<UniApp.GetStorageSuccess>;
/**
* 异步获取当前 storage 的相关信息
*
* 文档 http://uniapp.dcloud.io/api/storage/storage?id=getstorageinfo
*/
declare const getStorageInfo: (options?: UniApp.GetStorageInfoOptions | undefined) => Promise<UniApp.GetStorageInfoSuccess>;
/**
* 异步获取系统信息
*
* 文档 http://uniapp.dcloud.io/api/system/info?id=getsysteminfo
*/
declare const getSystemInfo: (options?: UniApp.GetSystemInfoOptions | undefined) => Promise<UniApp.GetSystemInfoResult>;
/**
* 获取用户信息
*
* 文档 http://uniapp.dcloud.io/api/plugins/login?id=getuserinfo
*/
declare const getUserInfo: (options?: UniApp.GetUserInfoOptions | undefined) => Promise<UniApp.GetUserInfoRes>;
/**
* 获取用户信息
*
* 文档 http://uniapp.dcloud.io/api/plugins/login?id=getUserProfile
*/
declare const getUserProfile: (options?: UniApp.GetUserProfileOptions | undefined) => Promise<UniApp.GetUserProfileRes>;
/**
* 压缩视频
*
* 文档 http://uniapp.dcloud.io/api/media/video?id=getvideoinfo
*/
declare const getVideoInfo: (options: UniApp.GetVideoInfoOptions) => Promise<UniApp.GetVideoInfoSuccessData>;
/**
* 隐藏返回首页按钮
*
* 文档 http://uniapp.dcloud.io/api/ui/navigationbar?id=hidehomebutton
*/
declare const hideHomeButton: () => Promise<never>;
/**
* 隐藏导航条加载动画
*
* 文档 http://uniapp.dcloud.io/api/ui/navigationbar?id=hidenavigationbarloading
*/
declare const hideNavigationBarLoading: () => Promise<never>;
/**
* 隐藏分享按钮
*
* 文档 http://uniapp.dcloud.io/api/plugins/share?id=hidesharemenu
*/
declare const hideShareMenu: (options: UniApp.HideShareMenuOptions) => Promise<any>;
/**
* 隐藏 TabBar
*
* 文档 http://uniapp.dcloud.io/api/ui/tabbar?id=hidetabbar
*/
declare const hideTabBar: (options?: UniApp.HideTabBarOptions | undefined) => Promise<any>;
/**
* 隐藏 TabBar 某一项的右上角的红点
*
* 文档 http://uniapp.dcloud.io/api/ui/tabbar?id=hidetabbarreddot
*/
declare const hideTabBarRedDot: (options: UniApp.HideTabBarRedDotOptions) => Promise<any>;
/**
* 动态加载网络字体
*
* 文档 http://uniapp.dcloud.io/api/ui/font?id=loadfontface
*/
declare const loadFontFace: (options: UniApp.LoadFontFaceOptions) => Promise<any>;
/**
* 登录
*
* 文档 http://uniapp.dcloud.io/api/plugins/login?id=login
*/
declare const login: (options?: UniApp.LoginOptions | undefined) => Promise<UniApp.LoginRes>;
/**
* 拨打电话
*
* 文档 http://uniapp.dcloud.io/api/system/phone?id=makephonecall
*/
declare const makePhoneCall: (options: UniApp.MakePhoneCallOptions) => Promise<any>;
/**
* 关闭当前页面,返回上一页面或多级页面
*
* 文档 http://uniapp.dcloud.io/api/router?id=navigateback
*/
declare const navigateBack: (options?: UniApp.NavigateBackOptions | undefined) => Promise<any>;
/**
* 跳转回上一个小程序,只有当另一个小程序跳转到当前小程序时才会能调用成功
*
* 文档 http://uniapp.dcloud.io/api/other/open-miniprogram?id=navigatebackminiprogram
*/
declare const navigateBackMiniProgram: (options?: UniApp.NavigateBackMiniProgramOptions | undefined) => Promise<any>;
/**
* 保留当前页面,跳转到应用内的某个页面
*
* 文档 http://uniapp.dcloud.io/api/router?id=navigateto
*/
declare const navigateTo: (options: UniApp.NavigateToOptions) => Promise<UniApp.NavigateToSuccessOptions>;
/**
* 调起客户端小程序设置界面,返回用户设置的操作结果
*
* 文档 http://uniapp.dcloud.io/api/other/open-miniprogram?id=navigatetominiprogram
*/
declare const navigateToMiniProgram: (options: UniApp.NavigateToMiniProgramOptions) => Promise<any>;
/**
* 启用低功耗蓝牙设备特征值变化时的notify功能,订阅特征值
*
* 文档 http://uniapp.dcloud.io/api/system/ble?id=notifyblecharacteristicvaluechange
*/
declare const notifyBLECharacteristicValueChange: (options: UniApp.NotifyBLECharacteristicValueChangeOptions) => Promise<UniApp.StopBluetoothDevicesDiscoverySuccess>;
/**
* 跳转系统授权管理页
*
* 文档 http://uniapp.dcloud.io/api/system/openappauthorizesetting
*/
declare const openAppAuthorizeSetting: (options?: UniApp.CallBackOptions | undefined) => Promise<UniApp.GeneralCallbackResult>;
/**
* 初始化蓝牙模块
*
* 文档 http://uniapp.dcloud.io/api/system/bluetooth?id=openbluetoothadapter
*/
declare const openBluetoothAdapter: (options?: UniApp.OpenBluetoothAdapterOptions | undefined) => Promise<any>;
/**
* 新开页面打开文档,支持格式 doc、xls、ppt、pdf、docx、xlsx、pptx
*
* 文档 http://uniapp.dcloud.io/api/file/file?id=opendocument
*/
declare const openDocument: (options: UniApp.OpenDocumentOptions) => Promise<any>;
/**
* 使用地图查看位置
*
* 文档 http://uniapp.dcloud.io/api/location/open-location?id=openlocation
*/
declare const openLocation: (options: UniApp.OpenLocationOptions) => Promise<any>;
/**
* 打开视频编辑器
*
* 文档 http://uniapp.dcloud.io/api/media/video?id=openvideoeditor
*/
declare const openVideoEditor: (options: UniApp.OpenVideoEditorOptions) => Promise<UniApp.OpenVideoEditorSuccessData>;
/**
* 将页面滚动到目标位置
*
* 文档 http://uniapp.dcloud.io/api/ui/scroll?id=pagescrollto
*/
declare const pageScrollTo: (options?: UniApp.PageScrollToOptions | undefined) => Promise<any>;
/**
* 预登录
*
* 文档 http://uniapp.dcloud.io/api/plugins/login?id=prelogin
*/
declare const preLogin: (options?: UniApp.PreLoginOptions | undefined) => Promise<any>;
/**
* 预览图片
*
* 文档 http://uniapp.dcloud.io/api/media/image?id=previewimage
*/
declare const previewImage: (options: UniApp.PreviewImageOptions) => Promise<any>;
/**
* 读取低功耗蓝牙设备指定特征值的二进制数据值
*
* 文档 http://uniapp.dcloud.io/api/system/ble?id=readblecharacteristicvalue
*/
declare const readBLECharacteristicValue: (options: UniApp.ReadBLECharacteristicValueOptions) => Promise<UniApp.ReadBLECharacteristicValueSuccess>;
/**
* 关闭当前页面,跳转到应用内的某个页面
*
* 文档 http://uniapp.dcloud.io/api/router?id=redirectto
*/
declare const redirectTo: (options: UniApp.RedirectToOptions) => Promise<any>;
/**
* 关闭所有页面,打开到应用内的某个页面
*
* 文档 http://uniapp.dcloud.io/api/router?id=relaunch
*/
declare const reLaunch: (options: UniApp.ReLaunchOptions) => Promise<any>;
/**
* 删除本地存储的文件
*
* 文档 http://uniapp.dcloud.io/api/file/file?id=removesavedfile
*/
declare const removeSavedFile: (options: UniApp.RemoveSavedFileOptions) => Promise<any>;
/**
* 从本地缓存中异步移除指定 key
*
* 文档 http://uniapp.dcloud.io/api/storage/storage?id=removestorage
*/
declare const removeStorage: (options: UniApp.RemoveStorageOptions) => Promise<any>;
/**
* 移除 TabBar 某一项右上角的文本
*
* 文档 http://uniapp.dcloud.io/api/ui/tabbar?id=removetabbarbadge
*/
declare const removeTabBarBadge: (options: UniApp.RemoveTabBarBadgeOptions) => Promise<any>;
/**
* 发起网络请求
*
* 文档 http://uniapp.dcloud.io/api/request/request?id=request
*/
declare function request<T = UniApp.RequestSuccessCallbackResult>(urlOrOptions: string | UniApp.RequestOptions, options?: UniApp.RequestOptions): RequestPromise<T>;
/**
* 支付
*
* 文档 http://uniapp.dcloud.io/api/plugins/payment?id=requestpayment
*/
declare const requestPayment: (options: UniApp.RequestPaymentOptions) => Promise<any>;
/**
* 需要基础库: `2.4.4`
*
* 在插件中使用:不支持
*
* 调起客户端小程序订阅消息界面,返回用户订阅消息的操作结果。当用户勾选了订阅面板中的“总是保持以上选择,不再询问”时,模板消息会被添加到用户的小程序设置页,通过
* [uni.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)
* 版本开始,开发版和体验版小程序将禁止使用模板消息 formId。
* - 一次授权调用里,每个tmplId对应的模板标题不能存在相同的,若出现相同的,只保留一个。
* - [2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
* 版本开始,支持订阅语音消息提醒,[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/subscribe-message.html)
*
* **错误码**
*
* | errCode | errMsg | 说明 |
* | ------- | ------------------------------------------------------ | -------------------------------------------------------------- |
* | 10001 | TmplIds can't be empty | 参数传空了 |
* | 10002 | Request list fail | 网络问题,请求消息列表失败 |
* | 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 | 小程序被禁封 |
* | 20013 | Reject DeviceMsg Template | 不允许通过该接口订阅设备消息 |
*
* 文档
* https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html
*/
declare const requestSubscribeMessage: (option: UniApp.RequestSubscribeMessageOption) => Promise<UniApp.RequestSubscribeMessageSuccessCallbackResult>;
/**
* 保存文件到本地
*
* 文档 http://uniapp.dcloud.io/api/file/file?id=savefile
*/
declare const saveFile: (options: UniApp.SaveFileOptions) => Promise<UniApp.SaveFileSuccess>;
/**
* 保存图片到系统相册
*
* 文档 http://uniapp.dcloud.io/api/media/image?id=saveimagetophotosalbum
*/
declare const saveImageToPhotosAlbum: (options: UniApp.SaveImageToPhotosAlbumOptions) => Promise<UniApp.SaveImageToPhotosAlbumResult>;
/**
* 保存视频到系统相册
*
* 文档 http://uniapp.dcloud.io/api/media/video?id=savevideotophotosalbum
*/
declare const saveVideoToPhotosAlbum: (options: UniApp.SaveVideoToPhotosAlbumOptions) => Promise<any>;
/**
* 调用扫码界面,扫码成功后返回对应的结果
*
* 文档 http://uniapp.dcloud.io/api/system/barcode?id=scancode
*/
declare const scanCode: (options?: UniApp.ScanCodeOptions | undefined) => Promise<UniApp.ScanCodeSuccessRes>;
/**
* 通过 WebSocket 连接发送数据
*
* 文档 http://uniapp.dcloud.io/api/request/websocket?id=sendsocketmessage
*/
declare const sendSocketMessage: () => (options: UniApp.SendSocketMessageOptions) => Promise<UniApp.GeneralCallbackResult>;
/**
* 动态设置窗口的背景色
*
* 文档 http://uniapp.dcloud.io/api/ui/bgcolor?id=setbackgroundcolor
*/
declare const setBackgroundColor: (options?: UniApp.SetBackgroundColorOptions | undefined) => Promise<any>;
/**
* 动态设置窗口的背景色
*
* 文档 http://uniapp.dcloud.io/api/ui/bgcolor?id=setbackgroundtextstyle
*/
declare const setBackgroundTextStyle: (options: UniApp.SetBackgroundTextStyleOptions) => Promise<any>;
/**
* 设置蓝牙最大传输单元
*
* 需在 createBLEConnection 调用成功后调用,mtu 设置范围 (22, 512)
*
* 安卓 5.1 以上有效
*
* 文档 http://uniapp.dcloud.io/api/system/ble?id=setBLEMTU
*/
declare const setBLEMTU: (options: UniApp.SetBLEMTUOptions) => Promise<any>;
/**
* 设置系统剪贴板的内容
*
* 文档 http://uniapp.dcloud.io/api/system/clipboard?id=setclipboarddata
*/
declare const setClipboardData: (options: UniApp.SetClipboardDataOptions) => Promise<any>;
/**
* 设置是否打开调试开关
*
* 此开关对正式版也能生效
*
* 文档 http://uniapp.dcloud.io/api/other/set-enable-debug?id=setenabledebug
*/
declare const setEnableDebug: (options: UniApp.SetEnableDebugOptions) => Promise<any>;
/**
* 设置是否保持常亮状态
*
* 文档 http://uniapp.dcloud.io/api/system/brightness?id=setkeepscreenon
*/
declare const setKeepScreenOn: (options: UniApp.SetKeepScreenOnOptions) => Promise<any>;
/**
* 设置导航条颜色
*
* 文档 http://uniapp.dcloud.io/api/ui/navigationbar?id=setnavigationbarcolor
*/
declare const setNavigationBarColor: (options?: UniApp.SetNavigationbarColorOptions | undefined) => Promise<any>;
/**
* 动态设置当前页面的标题
*
* 文档 http://uniapp.dcloud.io/api/ui/navigationbar?id=setnavigationbartitle
*/
declare const setNavigationBarTitle: (options: UniApp.SetNavigationBarTitleOptions) => Promise<any>;
/**
* 设置屏幕亮度
*
* 文档 http://uniapp.dcloud.io/api/system/brightness?id=setscreenbrightness
*/
declare const setScreenBrightness: (options: UniApp.SetScreenBrightnessOptions) => Promise<any>;
/**
* 将数据存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容
*
* 文档 http://uniapp.dcloud.io/api/storage/storage?id=setstorage
*/
declare const setStorage: (options: UniApp.SetStorageOptions) => Promise<any>;
/**
* 为 TabBar 某一项的右上角添加文本
*
* 文档 http://uniapp.dcloud.io/api/ui/tabbar?id=settabbarbadge
*/
declare const setTabBarBadge: (options: UniApp.SetTabBarBadgeOptions) => Promise<any>;
/**
* 动态设置 TabBar 某一项的内容
*
* 文档 http://uniapp.dcloud.io/api/ui/tabbar?id=settabbaritem
*/
declare const setTabBarItem: (options: UniApp.SetTabBarItemOptions) => Promise<any>;
/**
* 动态设置 TabBar 的整体样式
*
* 文档 http://uniapp.dcloud.io/api/ui/tabbar?id=settabbarstyle
*/
declare const setTabBarStyle: (options?: UniApp.SetTabBarStyleOptions | undefined) => Promise<any>;
/**
* 分享
*
* 文档 http://uniapp.dcloud.io/api/plugins/share?id=share
*/
declare const share: (options?: UniApp.ShareOptions | undefined) => Promise<any>;
/**
* 调用系统分享
*
* 文档 http://uniapp.dcloud.io/api/plugins/share?id=sharewithsystem
*/
declare const shareWithSystem: (options?: UniApp.ShareWithSystemOptions | undefined) => Promise<any>;
/**
* 显示操作菜单
*
* 文档 http://uniapp.dcloud.io/api/ui/prompt?id=showactionsheet
*/
declare const showActionSheet: (options: UniApp.ShowActionSheetOptions) => Promise<UniApp.ShowActionSheetRes>;
/**
* 显示 loading 提示框
*
* 文档 http://uniapp.dcloud.io/api/ui/prompt?id=showloading
*/
declare const showLoading: (options?: UniApp.ShowLoadingOptions | undefined) => Promise<any>;
/**
* 显示模态弹窗
*
* 文档 http://uniapp.dcloud.io/api/ui/prompt?id=showmodal
*/
declare const showModal: (options?: UniApp.ShowModalOptions | undefined) => Promise<UniApp.ShowModalRes>;
/**
* 在当前页面显示导航条加载动画
*
* 文档 http://uniapp.dcloud.io/api/ui/navigationbar?id=shownavigationbarloading
*/
declare const showNavigationBarLoading: () => Promise<never>;
/**
* 显示分享按钮
*
* 文档 http://uniapp.dcloud.io/api/plugins/share?id=showsharemenu
*/
declare const showShareMenu: (options?: UniApp.ShowShareMenuOptions | undefined) => Promise<any>;
/**
* 显示 tabBar
*
* 文档 http://uniapp.dcloud.io/api/ui/tabbar?id=showtabbar
*/
declare const showTabBar: (options?: UniApp.ShowTabBarOptions | undefined) => Promise<any>;
/**
* 显示 TabBar 某一项的右上角的红点
*
* 文档 http://uniapp.dcloud.io/api/ui/tabbar?id=showtabbarreddot
*/
declare const showTabBarRedDot: (options: UniApp.ShowTabBarRedDotOptions) => Promise<any>;
/**
* 显示消息提示框
*
* 文档 http://uniapp.dcloud.io/api/ui/prompt?id=showtoast
*/
declare const showToast: (options?: UniApp.ShowToastOptions | undefined) => Promise<any>;
/**
* 开始搜索附近的蓝牙设备
*
* 文档 http://uniapp.dcloud.io/api/system/bluetooth?id=startbluetoothdevicesdiscovery
*/
declare const startBluetoothDevicesDiscovery: (options?: UniApp.StartBluetoothDevicesDiscoveryOptions | undefined) => Promise<any>;
/**
* 开始下拉刷新
*
* 文档 http://uniapp.dcloud.io/api/ui/pulldown?id=startpulldownrefresh
*/
declare const startPullDownRefresh: (options?: UniApp.StartPullDownRefreshOptions | undefined) => Promise<any>;
/**
* 开始 SOTER 生物认证
*
* 文档 http://uniapp.dcloud.io/api/system/authentication?id=startsoterauthentication
*/
declare const startSoterAuthentication: (options: UniApp.StartSoterAuthenticationOptions) => Promise<UniApp.StartSoterAuthenticationRes>;
/**
* 停止搜寻附近的蓝牙外围设备
*
* 文档 http://uniapp.dcloud.io/api/system/bluetooth?id=stopbluetoothdevicesdiscovery
*/
declare const stopBluetoothDevicesDiscovery: (options?: UniApp.StopBluetoothDevicesDiscoveryOptions | undefined) => Promise<UniApp.StopBluetoothDevicesDiscoverySuccess>;
/**
* 跳转到 TabBar 页面,并关闭其它所有非 TabBar 页面
*
* 文档 http://uniapp.dcloud.io/api/router?id=switchtab
*/
declare const switchTab: (options: UniApp.SwitchTabOptions) => Promise<any>;
/**
* 上传文件
*
* 文档 http://uniapp.dcloud.io/api/request/network-file?id=uploadfile
*/
declare function uploadFile<T = UniApp.UploadFileSuccessCallbackResult>(urlOrOptions: string | UniApp.UploadFileOption, options?: UniApp.UploadFileOption): UploadFilePromise<T>;
/**
* 使手机发生振动
*
* 文档 https://uniapp.dcloud.net.cn/api/system/vibrate.html#vibrate
*/
declare const vibrate: (options?: UniApp.VibrateOptions | undefined) => Promise<any>;
/**
* 使手机发生较长时间的振动(400ms)
*
* 文档 http://uniapp.dcloud.io/api/system/vibrate?id=vibratelong
*/
declare const vibrateLong: (options?: UniApp.VibrateLongOptions | undefined) => Promise<any>;
/**
* 使手机发生较短时间的振动(15ms)
*
* 文档 http://uniapp.dcloud.io/api/system/vibrate?id=vibrateshort
*/
declare const vibrateShort: (options?: UniApp.VibrateShortOptions | undefined) => Promise<any>;
/**
* 向低功耗蓝牙设备指定特征值写入二进制数据
*
* 文档 http://uniapp.dcloud.io/api/system/ble?id=writeblecharacteristicvalue
*/
declare const writeBLECharacteristicValue: (options: UniApp.WriteBLECharacteristicValueOptions) => Promise<UniApp.StopBluetoothDevicesDiscoverySuccess>;
export { type DownloadFilePromise, type MapContext, type RequestPromise, type TaskPromise, type UploadFilePromise, addPhoneContact, authorize, checkIsSoterEnrolledInDevice, checkIsSupportSoterAuthentication, checkSession, chooseAddress, chooseFile, chooseImage, chooseInvoice, chooseInvoiceTitle, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, clearStorage, closeBLEConnection, closeBluetoothAdapter, closePreviewImage, closeSocket, compressImage, compressVideo, connectSocket, createBLEConnection, createCameraContext, createCanvasContext, createInnerAudioContext, createLivePlayerContext, createLivePusherContext, createMapContext, createMediaContainer, createPushMessage, createSelectorQuery, createVideoContext, downloadFile, _getApp as getApp, getBLEDeviceCharacteristics, getBLEDeviceRSSI, getBLEDeviceServices, getBackgroundAudioManager, getBatteryInfo, getBluetoothAdapterState, getBluetoothDevices, getCheckBoxState, getClipboardData, getConnectedBluetoothDevices, getExtConfig, getFileInfo, getImageInfo, getLocation, getNetworkType, getProvider, getPushClientId, getRecordManager, getSavedFileInfo, getSavedFileList, getScreenBrightness, getSelectedTextRange, getSetting, getStorage, getStorageInfo, getSystemInfo, getUserInfo, getUserProfile, getVideoInfo, hideHomeButton, hideNavigationBarLoading, hideShareMenu, hideTabBar, hideTabBarRedDot, loadFontFace, login, makePhoneCall, mountTaskMethodToPromise, navigateBack, navigateBackMiniProgram, navigateTo, navigateToMiniProgram, noop, notifyBLECharacteristicValueChange, openAppAuthorizeSetting, openBluetoothAdapter, openDocument, openLocation, openVideoEditor, pageScrollTo, preLogin, previewImage, promisify, reLaunch, readBLECharacteristicValue, redirectTo, removeSavedFile, removeStorage, removeTabBarBadge, request, requestPayment, requestSubscribeMessage, saveFile, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, sendSocketMessage, setBLEMTU, setBackgroundColor, setBackgroundTextStyle, setClipboardData, setEnableDebug, setKeepScreenOn, setNavigationBarColor, setNavigationBarTitle, setScreenBrightness, setStorage, setTabBarBadge, setTabBarItem, setTabBarStyle, share, shareWithSystem, showActionSheet, showLoading, showModal, showNavigationBarLoading, showShareMenu, showTabBar, showTabBarRedDot, showToast, startBluetoothDevicesDiscovery, startPullDownRefresh, startSoterAuthentication, stopBluetoothDevicesDiscovery, switchTab, uploadFile, vibrate, vibrateLong, vibrateShort, writeBLECharacteristicValue };