@tarojs/taro-h5 3.6.6-alpha.2 → 3.6.6-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/base/index.d.ts +1 -2
- package/dist/api/base/index.js +3 -3
- package/dist/api/base/index.js.map +1 -1
- package/dist/api/base/weapp/app-event.d.ts +10 -10
- package/dist/api/base/weapp/app-event.js +77 -9
- package/dist/api/base/weapp/app-event.js.map +1 -1
- package/dist/api/canvas/CanvasContext.d.ts +2 -1
- package/dist/api/canvas/CanvasContext.js.map +1 -1
- package/dist/api/device/accelerometer.js +1 -2
- package/dist/api/device/accelerometer.js.map +1 -1
- package/dist/api/device/compass.js +1 -2
- package/dist/api/device/compass.js.map +1 -1
- package/dist/api/device/motion.js +1 -2
- package/dist/api/device/motion.js.map +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/network/request/index.d.ts +1 -1
- package/dist/api/network/request/index.js +22 -17
- package/dist/api/network/request/index.js.map +1 -1
- package/dist/index.cjs.d.ts +27 -39
- package/dist/index.cjs.js +132 -125
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.d.ts +27 -39
- package/dist/index.esm.js +105 -74
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/utils/handler.d.ts +13 -26
- package/dist/utils/handler.js +4 -16
- package/dist/utils/handler.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +15 -11
- package/dist/utils/lodash.d.ts +0 -3
- package/dist/utils/lodash.js +0 -32
- package/dist/utils/lodash.js.map +0 -1
package/dist/index.esm.d.ts
CHANGED
|
@@ -37,7 +37,8 @@ declare const env: {
|
|
|
37
37
|
TARO_PLATFORM: string | undefined;
|
|
38
38
|
TARO_VERSION: string | undefined;
|
|
39
39
|
};
|
|
40
|
-
|
|
40
|
+
// Note: 该方法由 taro-plugin-platform-h5 实现
|
|
41
|
+
// export const canIUse = temporarilyNotSupport('canIUse')
|
|
41
42
|
declare function arrayBufferToBase64(arrayBuffer: ArrayBuffer): string;
|
|
42
43
|
declare function base64ToArrayBuffer(base64: string): Uint8Array;
|
|
43
44
|
// 加密
|
|
@@ -72,22 +73,22 @@ declare const getSystemInfo: typeof Taro.getSystemInfo;
|
|
|
72
73
|
declare const updateWeChatApp: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
73
74
|
declare const getUpdateManager: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
74
75
|
// 应用级事件
|
|
75
|
-
declare const onUnhandledRejection:
|
|
76
|
-
declare const onThemeChange:
|
|
77
|
-
declare const onPageNotFound:
|
|
78
|
-
declare const onError:
|
|
76
|
+
declare const onUnhandledRejection: typeof Taro.onUnhandledRejection;
|
|
77
|
+
declare const onThemeChange: typeof Taro.onThemeChange;
|
|
78
|
+
declare const onPageNotFound: typeof Taro.onPageNotFound;
|
|
79
|
+
declare const onError: typeof Taro.onError;
|
|
79
80
|
declare const onAudioInterruptionEnd: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
80
81
|
declare const onAudioInterruptionBegin: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
81
82
|
declare const onAppShow: typeof Taro.onAppShow;
|
|
82
83
|
declare const onAppHide: typeof Taro.onAppHide;
|
|
83
|
-
declare const offUnhandledRejection:
|
|
84
|
-
declare const offThemeChange:
|
|
85
|
-
declare const offPageNotFound:
|
|
86
|
-
declare const offError:
|
|
84
|
+
declare const offUnhandledRejection: typeof Taro.offUnhandledRejection;
|
|
85
|
+
declare const offThemeChange: typeof Taro.offThemeChange;
|
|
86
|
+
declare const offPageNotFound: typeof Taro.offPageNotFound;
|
|
87
|
+
declare const offError: typeof Taro.offError;
|
|
87
88
|
declare const offAudioInterruptionEnd: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
88
89
|
declare const offAudioInterruptionBegin: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
89
|
-
declare const offAppShow: typeof Taro.
|
|
90
|
-
declare const offAppHide: typeof Taro.
|
|
90
|
+
declare const offAppShow: typeof Taro.offAppShow;
|
|
91
|
+
declare const offAppHide: typeof Taro.offAppHide;
|
|
91
92
|
// 生命周期
|
|
92
93
|
declare const getLaunchOptionsSync: typeof Taro.getLaunchOptionsSync;
|
|
93
94
|
declare const getEnterOptionsSync: typeof Taro.getEnterOptionsSync;
|
|
@@ -360,36 +361,23 @@ declare const createMediaAudioPlayer: (option?: {}, ...args: any[]) => Promise<P
|
|
|
360
361
|
*/
|
|
361
362
|
declare const createInnerAudioContext: typeof Taro.createInnerAudioContext;
|
|
362
363
|
declare const createAudioContext: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
363
|
-
type
|
|
364
|
-
interface ICallbackManagerOption {
|
|
365
|
-
callback?:
|
|
364
|
+
type TCallbackManagerFunc<T extends unknown[] = unknown[]> = (...arr: T) => void;
|
|
365
|
+
interface ICallbackManagerOption<T extends unknown[] = unknown[]> {
|
|
366
|
+
callback?: TCallbackManagerFunc<T>;
|
|
366
367
|
ctx?: any;
|
|
367
368
|
[key: string]: unknown;
|
|
368
369
|
}
|
|
369
|
-
type
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
add: (opt?: TCallbackManagerListItem) => void;
|
|
378
|
-
/**
|
|
379
|
-
* 移除回调
|
|
380
|
-
* @param {{ callback: function, ctx: any } | function} opt
|
|
381
|
-
*/
|
|
382
|
-
remove: (opt?: TCallbackManagerListItem) => void;
|
|
383
|
-
/**
|
|
384
|
-
* 获取回调函数数量
|
|
385
|
-
* @return {number}
|
|
386
|
-
*/
|
|
370
|
+
type TCallbackManagerUnit<T extends unknown[] = unknown[]> = (TCallbackManagerFunc<T> | ICallbackManagerOption<T>);
|
|
371
|
+
declare class CallbackManager<T extends unknown[] = unknown[]> {
|
|
372
|
+
callbacks: TCallbackManagerUnit<T>[];
|
|
373
|
+
/** 添加回调 */
|
|
374
|
+
add: (opt?: TCallbackManagerUnit<T>) => void;
|
|
375
|
+
/** 移除回调 */
|
|
376
|
+
remove: (opt?: TCallbackManagerUnit<T>) => void;
|
|
377
|
+
/** 获取回调函数数量 */
|
|
387
378
|
count: () => number;
|
|
388
|
-
/**
|
|
389
|
-
|
|
390
|
-
* @param {...any} args 回调的调用参数
|
|
391
|
-
*/
|
|
392
|
-
trigger: (...args: TCallbackManagerList) => void;
|
|
379
|
+
/** 触发回调 */
|
|
380
|
+
trigger: (...args: T) => void;
|
|
393
381
|
}
|
|
394
382
|
declare class BackgroundAudioManager implements Taro.BackgroundAudioManager {
|
|
395
383
|
Instance?: HTMLAudioElement;
|
|
@@ -553,7 +541,7 @@ declare const offLocalServiceResolveFail: (option?: {}, ...args: any[]) => Promi
|
|
|
553
541
|
declare const offLocalServiceLost: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
554
542
|
declare const offLocalServiceFound: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
555
543
|
declare const offLocalServiceDiscoveryStop: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
556
|
-
declare const request:
|
|
544
|
+
declare const request: <T = any, U = any>(option: Taro.request.Option<T, U>) => Taro.RequestTask<T>;
|
|
557
545
|
declare const addInterceptor: any;
|
|
558
546
|
declare const cleanInterceptors: any;
|
|
559
547
|
// TCP 通信
|
|
@@ -776,5 +764,5 @@ declare const createWorker: (option?: {}, ...args: any[]) => Promise<Partial<Tar
|
|
|
776
764
|
declare const createSelectorQuery: typeof Taro.createSelectorQuery;
|
|
777
765
|
declare const createIntersectionObserver: typeof Taro.createIntersectionObserver;
|
|
778
766
|
declare const createMediaQueryObserver: typeof Taro.createMediaQueryObserver;
|
|
779
|
-
export { taro as default, taro, createRewardedVideoAd, createInterstitialAd, stopFaceDetect, initFaceDetect, faceDetect, isVKSupport, createVKSession, getOpenUserInfo, env,
|
|
767
|
+
export { taro as default, taro, createRewardedVideoAd, createInterstitialAd, stopFaceDetect, initFaceDetect, faceDetect, isVKSupport, createVKSession, getOpenUserInfo, env, arrayBufferToBase64, base64ToArrayBuffer, getUserCryptoManager, setEnableDebug, getRealtimeLogManager, getLogManager, reportPerformance, getPerformance, openSystemBluetoothSetting, openAppAuthorizeSetting, getWindowInfo, getSystemSetting, getDeviceInfo, getAppBaseInfo, getAppAuthorizeSetting, getSystemInfoSync, getSystemInfoAsync, getSystemInfo, updateWeChatApp, getUpdateManager, onUnhandledRejection, onThemeChange, onPageNotFound, onError, onAudioInterruptionEnd, onAudioInterruptionBegin, onAppShow, onAppHide, offUnhandledRejection, offThemeChange, offPageNotFound, offError, offAudioInterruptionEnd, offAudioInterruptionBegin, offAppShow, offAppHide, getLaunchOptionsSync, getEnterOptionsSync, createOffscreenCanvas, createCanvasContext, canvasToTempFilePath, canvasPutImageData, canvasGetImageData, cloud, reportMonitor, reportAnalytics, reportEvent, getExptInfoSync, stopAccelerometer, startAccelerometer, onAccelerometerChange, offAccelerometerChange, checkIsOpenAccessibility, getBatteryInfoSync, getBatteryInfo, stopBluetoothDevicesDiscovery, startBluetoothDevicesDiscovery, openBluetoothAdapter, onBluetoothDeviceFound, onBluetoothAdapterStateChange, offBluetoothDeviceFound, offBluetoothAdapterStateChange, makeBluetoothPair, isBluetoothDevicePaired, getConnectedBluetoothDevices, getBluetoothDevices, getBluetoothAdapterState, closeBluetoothAdapter, writeBLECharacteristicValue, setBLEMTU, readBLECharacteristicValue, onBLEMTUChange, onBLEConnectionStateChange, onBLECharacteristicValueChange, offBLEMTUChange, offBLEConnectionStateChange, offBLECharacteristicValueChange, notifyBLECharacteristicValueChange, getBLEMTU, getBLEDeviceServices, getBLEDeviceRSSI, getBLEDeviceCharacteristics, createBLEConnection, closeBLEConnection, onBLEPeripheralConnectionStateChanged, offBLEPeripheralConnectionStateChanged, createBLEPeripheralServer, addPhoneRepeatCalendar, addPhoneCalendar, setClipboardData, getClipboardData, stopCompass, startCompass, onCompassChange, offCompassChange, chooseContact, addPhoneContact, getRandomValues, stopGyroscope, startGyroscope, onGyroscopeChange, offGyroscopeChange, stopBeaconDiscovery, startBeaconDiscovery, onBeaconUpdate, onBeaconServiceChange, offBeaconUpdate, offBeaconServiceChange, getBeacons, onKeyboardHeightChange, offKeyboardHeightChange, hideKeyboard, getSelectedTextRange, onMemoryWarning, offMemoryWarning, stopDeviceMotionListening, startDeviceMotionListening, onDeviceMotionChange, offDeviceMotionChange, getNetworkType, onNetworkWeakChange, onNetworkStatusChange, offNetworkWeakChange, offNetworkStatusChange, getLocalIPAddress, stopHCE, startHCE, sendHCEMessage, onHCEMessage, offHCEMessage, getNFCAdapter, getHCEState, makePhoneCall, scanCode, setVisualEffectOnCapture, setScreenBrightness, setKeepScreenOn, onUserCaptureScreen, offUserCaptureScreen, getScreenBrightness, vibrateShort, vibrateLong, stopWifi, startWifi, setWifiList, onWifiConnectedWithPartialInfo, onWifiConnected, onGetWifiList, offWifiConnected, offGetWifiList, getWifiList, getConnectedWifi, connectWifi, getExtConfigSync, getExtConfig, saveFileToDisk, saveFile, removeSavedFile, openDocument, getSavedFileList, getSavedFileInfo, getFileSystemManager, getFileInfo, getApp, getCurrentInstance, stopLocationUpdate, startLocationUpdateBackground, startLocationUpdate, openLocation, onLocationChangeError, onLocationChange, offLocationChangeError, offLocationChange, getLocation, choosePoi, getFuzzyLocation, chooseLocation, stopVoice, setInnerAudioOption, playVoice, pauseVoice, getAvailableAudioSources, createWebAudioContext, createMediaAudioPlayer, createInnerAudioContext, createAudioContext, stopBackgroundAudio, seekBackgroundAudio, playBackgroundAudio, pauseBackgroundAudio, onBackgroundAudioStop, onBackgroundAudioPlay, onBackgroundAudioPause, getBackgroundAudioPlayerState, getBackgroundAudioManager, createCameraContext, saveImageToPhotosAlbum, previewMedia, getImageInfo, previewImage, compressImage, chooseMessageFile, chooseImage, createLivePusherContext, createLivePlayerContext, createMapContext, createMediaRecorder, stopRecord, startRecord, getRecorderManager, saveVideoToPhotosAlbum, openVideoEditor, getVideoInfo, createVideoContext, compressVideo, chooseVideo, chooseMedia, createVideoDecoder, createMediaContainer, updateVoIPChatMuteConfig, subscribeVoIPVideoMembers, setEnable1v1Chat, onVoIPVideoMembersChanged, onVoIPChatStateChanged, onVoIPChatSpeakersChanged, onVoIPChatMembersChanged, onVoIPChatInterrupted, offVoIPVideoMembersChanged, offVoIPChatStateChanged, offVoIPChatMembersChanged, offVoIPChatInterrupted, joinVoIPChat, exitVoIPChat, openEmbeddedMiniProgram, navigateToMiniProgram, navigateBackMiniProgram, exitMiniProgram, openBusinessView, downloadFile, stopLocalServiceDiscovery, startLocalServiceDiscovery, onLocalServiceResolveFail, onLocalServiceLost, onLocalServiceFound, onLocalServiceDiscoveryStop, offLocalServiceResolveFail, offLocalServiceLost, offLocalServiceFound, offLocalServiceDiscoveryStop, request, addInterceptor, cleanInterceptors, createTCPSocket, createUDPSocket, uploadFile, sendSocketMessage, onSocketOpen, onSocketMessage, onSocketError, onSocketClose, connectSocket, closeSocket, getAccountInfoSync, chooseAddress, authorizeForMiniProgram, authorize, openCard, addCard, reserveChannelsLive, openChannelsLive, openChannelsEvent, openChannelsActivity, getChannelsLiveNoticeInfo, getChannelsLiveInfo, openCustomerServiceChat, checkIsSupportFacialRecognition, startFacialRecognitionVerify, startFacialRecognitionVerifyAndUploadVideo, faceVerifyForPay, addVideoToFavorites, addFileToFavorites, checkIsAddedToMyMiniProgram, getGroupEnterInfo, chooseInvoiceTitle, chooseInvoice, chooseLicensePlate, pluginLogin, login, checkSession, showRedPackage, openSetting, getSetting, startSoterAuthentication, checkIsSupportSoterAuthentication, checkIsSoterEnrolledInDevice, requestSubscribeMessage, getUserProfile, getUserInfo, shareToWeRun, getWeRunData, requestPayment, requestOrderPayment, updateShareMenu, showShareMenu, showShareImageMenu, shareVideoMessage, shareFileMessage, onCopyUrl, offCopyUrl, hideShareMenu, getShareInfo, authPrivateMessage, setStorageSync, setStorage, revokeBufferURL, removeStorageSync, removeStorage, getStorageSync, getStorageInfoSync, getStorageInfo, getStorage, createBufferURL, clearStorageSync, clearStorage, setBackgroundFetchToken, onBackgroundFetchData, getBackgroundFetchToken, getBackgroundFetchData, setPageInfo, ocrIdCard, ocrBankCard, ocrDrivingLicense, ocrVehicleLicense, textReview, textToAudio, imageAudit, advancedGeneralIdentify, objectDetectIdentify, carClassify, dishClassify, logoClassify, animalClassify, plantClassify, getSwanId, requestPolymerPayment, navigateToSmartGameProgram, navigateToSmartProgram, navigateBackSmartProgram, preloadSubPackage, createAnimation, setBackgroundTextStyle, setBackgroundColor, nextTick, loadFontFace, disableAlertBeforeUnload, enableAlertBeforeUnload, hideLoading, hideToast, showActionSheet, showLoading, showModal, showToast, getMenuButtonBoundingClientRect, showNavigationBarLoading, setNavigationBarTitle, setNavigationBarColor, hideNavigationBarLoading, hideHomeButton, startPullDownRefresh, stopPullDownRefresh, pageScrollTo, setTopBarText, initTabBarApis, showTabBarRedDot, showTabBar, setTabBarStyle, setTabBarItem, setTabBarBadge, removeTabBarBadge, hideTabBarRedDot, hideTabBar, setWindowSize, onWindowResize, offWindowResize, createWorker, createSelectorQuery, createIntersectionObserver, createMediaQueryObserver, Behavior, canIUseWebp, Current, ENV_TYPE, eventCenter, Events, getAppInfo, getEnv, history, initPxTransform, interceptorify, interceptors, Link, options, preload, pxTransform, requirePlugin };
|
|
780
768
|
export { getCurrentPages, navigateBack, navigateTo, redirectTo, reLaunch, switchTab } from "@tarojs/router";
|
package/dist/index.esm.js
CHANGED
|
@@ -6,6 +6,7 @@ import { getCurrentPage, getHomePage } from '@tarojs/router/dist/utils';
|
|
|
6
6
|
import { hooks, Current as Current$1 } from '@tarojs/runtime';
|
|
7
7
|
import { fromByteArray, toByteArray } from 'base64-js';
|
|
8
8
|
import { getMobileDetect, setTitle } from '@tarojs/router/dist/utils/navigate';
|
|
9
|
+
import { isNil, throttle } from 'lodash-es';
|
|
9
10
|
import { parse, stringify } from 'query-string';
|
|
10
11
|
import { defineCustomElementTaroSwiperCore, defineCustomElementTaroSwiperItemCore } from '@tarojs/components/dist/components';
|
|
11
12
|
import 'whatwg-fetch';
|
|
@@ -48,18 +49,12 @@ class MethodHandler {
|
|
|
48
49
|
class CallbackManager {
|
|
49
50
|
constructor() {
|
|
50
51
|
this.callbacks = [];
|
|
51
|
-
/**
|
|
52
|
-
* 添加回调
|
|
53
|
-
* @param {{ callback: function, ctx: any } | function} opt
|
|
54
|
-
*/
|
|
52
|
+
/** 添加回调 */
|
|
55
53
|
this.add = (opt) => {
|
|
56
54
|
if (opt)
|
|
57
55
|
this.callbacks.push(opt);
|
|
58
56
|
};
|
|
59
|
-
/**
|
|
60
|
-
* 移除回调
|
|
61
|
-
* @param {{ callback: function, ctx: any } | function} opt
|
|
62
|
-
*/
|
|
57
|
+
/** 移除回调 */
|
|
63
58
|
this.remove = (opt) => {
|
|
64
59
|
if (opt) {
|
|
65
60
|
let pos = -1;
|
|
@@ -73,17 +68,11 @@ class CallbackManager {
|
|
|
73
68
|
}
|
|
74
69
|
}
|
|
75
70
|
};
|
|
76
|
-
/**
|
|
77
|
-
* 获取回调函数数量
|
|
78
|
-
* @return {number}
|
|
79
|
-
*/
|
|
71
|
+
/** 获取回调函数数量 */
|
|
80
72
|
this.count = () => {
|
|
81
73
|
return this.callbacks.length;
|
|
82
74
|
};
|
|
83
|
-
/**
|
|
84
|
-
* 触发回调
|
|
85
|
-
* @param {...any} args 回调的调用参数
|
|
86
|
-
*/
|
|
75
|
+
/** 触发回调 */
|
|
87
76
|
this.trigger = (...args) => {
|
|
88
77
|
this.callbacks.forEach(opt => {
|
|
89
78
|
if (isFunction(opt)) {
|
|
@@ -113,36 +102,6 @@ const getTimingFunc = (easeFunc, frameCnt) => {
|
|
|
113
102
|
};
|
|
114
103
|
};
|
|
115
104
|
|
|
116
|
-
function throttle(fn, threshold = 250, scope) {
|
|
117
|
-
let lastTime = 0;
|
|
118
|
-
let deferTimer;
|
|
119
|
-
return function (...args) {
|
|
120
|
-
const context = scope || this;
|
|
121
|
-
const now = Date.now();
|
|
122
|
-
if (now - lastTime > threshold) {
|
|
123
|
-
fn.apply(this, args);
|
|
124
|
-
lastTime = now;
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
clearTimeout(deferTimer);
|
|
128
|
-
deferTimer = setTimeout(() => {
|
|
129
|
-
lastTime = now;
|
|
130
|
-
fn.apply(context, args);
|
|
131
|
-
}, threshold);
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
function debounce(fn, ms = 250, scope) {
|
|
136
|
-
let timer;
|
|
137
|
-
return function (...args) {
|
|
138
|
-
const context = scope || this;
|
|
139
|
-
clearTimeout(timer);
|
|
140
|
-
timer = setTimeout(function () {
|
|
141
|
-
fn.apply(context, args);
|
|
142
|
-
}, ms);
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
|
|
146
105
|
const VALID_COLOR_REG = /^#[0-9a-fA-F]{6}$/;
|
|
147
106
|
const isValidColor = (color) => {
|
|
148
107
|
return VALID_COLOR_REG.test(color);
|
|
@@ -834,14 +793,34 @@ const getSystemInfo = (options = {}) => __awaiter(void 0, void 0, void 0, functi
|
|
|
834
793
|
const updateWeChatApp = temporarilyNotSupport('updateWeChatApp');
|
|
835
794
|
const getUpdateManager = temporarilyNotSupport('getUpdateManager');
|
|
836
795
|
|
|
796
|
+
const unhandledRejectionCallbackManager = new CallbackManager();
|
|
797
|
+
const themeChangeCallbackManager = new CallbackManager();
|
|
798
|
+
const pageNotFoundCallbackManager = new CallbackManager();
|
|
799
|
+
const errorCallbackManager = new CallbackManager();
|
|
837
800
|
const appShowCallbackManager = new CallbackManager();
|
|
838
801
|
const appHideCallbackManager = new CallbackManager();
|
|
802
|
+
const unhandledRejectionListener = (res) => {
|
|
803
|
+
unhandledRejectionCallbackManager.trigger(res);
|
|
804
|
+
};
|
|
805
|
+
let themeMatchMedia = null;
|
|
806
|
+
const themeChangeListener = (res) => {
|
|
807
|
+
themeChangeCallbackManager.trigger({
|
|
808
|
+
theme: res.matches ? 'dark' : 'light'
|
|
809
|
+
});
|
|
810
|
+
};
|
|
811
|
+
const pageNotFoundListener = (res) => {
|
|
812
|
+
pageNotFoundCallbackManager.trigger(res);
|
|
813
|
+
};
|
|
814
|
+
const errorListener = (res) => {
|
|
815
|
+
// @ts-ignore
|
|
816
|
+
errorCallbackManager.trigger(res.stack || res.message || res);
|
|
817
|
+
};
|
|
839
818
|
const getApp$1 = () => {
|
|
840
819
|
var _a;
|
|
841
820
|
const path = (_a = Taro.Current.page) === null || _a === void 0 ? void 0 : _a.path;
|
|
842
821
|
return {
|
|
843
822
|
/** 小程序切前台的路径 */
|
|
844
|
-
path: path === null || path === void 0 ? void 0 : path.substring(0, path.indexOf('?')),
|
|
823
|
+
path: (path === null || path === void 0 ? void 0 : path.substring(0, path.indexOf('?'))) || '',
|
|
845
824
|
/** 小程序切前台的 query 参数 */
|
|
846
825
|
query: parse(location.search),
|
|
847
826
|
/** 来源信息。 */
|
|
@@ -863,10 +842,33 @@ const appHideListener = () => {
|
|
|
863
842
|
}
|
|
864
843
|
};
|
|
865
844
|
// 应用级事件
|
|
866
|
-
const onUnhandledRejection =
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
845
|
+
const onUnhandledRejection = callback => {
|
|
846
|
+
unhandledRejectionCallbackManager.add(callback);
|
|
847
|
+
if (unhandledRejectionCallbackManager.count() === 1) {
|
|
848
|
+
window.addEventListener('unhandledrejection', unhandledRejectionListener);
|
|
849
|
+
}
|
|
850
|
+
};
|
|
851
|
+
const onThemeChange = callback => {
|
|
852
|
+
themeChangeCallbackManager.add(callback);
|
|
853
|
+
if (themeChangeCallbackManager.count() === 1) {
|
|
854
|
+
if (isNil(themeMatchMedia)) {
|
|
855
|
+
themeMatchMedia = window.matchMedia('(prefers-color-scheme: light)');
|
|
856
|
+
}
|
|
857
|
+
themeMatchMedia.addEventListener('change', themeChangeListener);
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
const onPageNotFound = callback => {
|
|
861
|
+
pageNotFoundCallbackManager.add(callback);
|
|
862
|
+
if (pageNotFoundCallbackManager.count() === 1) {
|
|
863
|
+
Taro.eventCenter.on('__taroRouterNotFound', pageNotFoundListener);
|
|
864
|
+
}
|
|
865
|
+
};
|
|
866
|
+
const onError = callback => {
|
|
867
|
+
errorCallbackManager.add(callback);
|
|
868
|
+
if (errorCallbackManager.count() === 1) {
|
|
869
|
+
window.addEventListener('error', errorListener);
|
|
870
|
+
}
|
|
871
|
+
};
|
|
870
872
|
const onAudioInterruptionEnd = temporarilyNotSupport('onAudioInterruptionEnd');
|
|
871
873
|
const onAudioInterruptionBegin = temporarilyNotSupport('onAudioInterruptionBegin');
|
|
872
874
|
const onAppShow = callback => {
|
|
@@ -881,10 +883,34 @@ const onAppHide = callback => {
|
|
|
881
883
|
window.addEventListener('visibilitychange', appHideListener);
|
|
882
884
|
}
|
|
883
885
|
};
|
|
884
|
-
const offUnhandledRejection =
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
886
|
+
const offUnhandledRejection = callback => {
|
|
887
|
+
unhandledRejectionCallbackManager.remove(callback);
|
|
888
|
+
if (unhandledRejectionCallbackManager.count() === 0) {
|
|
889
|
+
window.removeEventListener('unhandledrejection', unhandledRejectionListener);
|
|
890
|
+
}
|
|
891
|
+
};
|
|
892
|
+
const offThemeChange = callback => {
|
|
893
|
+
themeChangeCallbackManager.remove(callback);
|
|
894
|
+
if (themeChangeCallbackManager.count() === 0) {
|
|
895
|
+
if (isNil(themeMatchMedia)) {
|
|
896
|
+
themeMatchMedia = window.matchMedia('(prefers-color-scheme: light)');
|
|
897
|
+
}
|
|
898
|
+
themeMatchMedia.removeEventListener('change', themeChangeListener);
|
|
899
|
+
themeMatchMedia = null;
|
|
900
|
+
}
|
|
901
|
+
};
|
|
902
|
+
const offPageNotFound = callback => {
|
|
903
|
+
pageNotFoundCallbackManager.remove(callback);
|
|
904
|
+
if (pageNotFoundCallbackManager.count() === 0) {
|
|
905
|
+
Taro.eventCenter.off('__taroRouterNotFound', pageNotFoundListener);
|
|
906
|
+
}
|
|
907
|
+
};
|
|
908
|
+
const offError = callback => {
|
|
909
|
+
errorCallbackManager.remove(callback);
|
|
910
|
+
if (errorCallbackManager.count() === 0) {
|
|
911
|
+
window.removeEventListener('error', errorListener);
|
|
912
|
+
}
|
|
913
|
+
};
|
|
888
914
|
const offAudioInterruptionEnd = temporarilyNotSupport('offAudioInterruptionEnd');
|
|
889
915
|
const offAudioInterruptionBegin = temporarilyNotSupport('offAudioInterruptionBegin');
|
|
890
916
|
const offAppShow = callback => {
|
|
@@ -921,7 +947,8 @@ const env = {
|
|
|
921
947
|
TARO_PLATFORM: process.env.TARO_PLATFORM,
|
|
922
948
|
TARO_VERSION: process.env.TARO_VERSION,
|
|
923
949
|
};
|
|
924
|
-
|
|
950
|
+
// Note: 该方法由 taro-plugin-platform-h5 实现
|
|
951
|
+
// export const canIUse = temporarilyNotSupport('canIUse')
|
|
925
952
|
function arrayBufferToBase64(arrayBuffer) {
|
|
926
953
|
return fromByteArray(arrayBuffer);
|
|
927
954
|
}
|
|
@@ -2908,7 +2935,7 @@ const offLocalServiceDiscoveryStop = temporarilyNotSupport('offLocalServiceDisco
|
|
|
2908
2935
|
|
|
2909
2936
|
// @ts-ignore
|
|
2910
2937
|
const { Link: Link$1 } = Taro;
|
|
2911
|
-
function generateRequestUrlWithParams(url, params) {
|
|
2938
|
+
function generateRequestUrlWithParams(url = '', params) {
|
|
2912
2939
|
params = typeof params === 'string' ? params : serializeParams(params);
|
|
2913
2940
|
if (params) {
|
|
2914
2941
|
url += (~url.indexOf('?') ? '&' : '?') + params;
|
|
@@ -2916,26 +2943,21 @@ function generateRequestUrlWithParams(url, params) {
|
|
|
2916
2943
|
url = url.replace('?&', '?');
|
|
2917
2944
|
return url;
|
|
2918
2945
|
}
|
|
2919
|
-
|
|
2920
|
-
function _request(options) {
|
|
2921
|
-
options = options || {};
|
|
2922
|
-
if (typeof options === 'string') {
|
|
2923
|
-
options = {
|
|
2924
|
-
url: options
|
|
2925
|
-
};
|
|
2926
|
-
}
|
|
2946
|
+
function _request(options = {}) {
|
|
2927
2947
|
const { success, complete, fail } = options;
|
|
2928
|
-
let url = options.url;
|
|
2948
|
+
let url = options.url || '';
|
|
2929
2949
|
const params = {};
|
|
2930
2950
|
const res = {};
|
|
2931
2951
|
if (options.jsonp) {
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2952
|
+
const { jsonp } = options, opts = __rest(options, ["jsonp"]);
|
|
2953
|
+
Object.assign(params, opts);
|
|
2954
|
+
// @ts-ignore
|
|
2955
|
+
params.params = opts.data;
|
|
2956
|
+
params.cache = opts.jsonpCache;
|
|
2957
|
+
if (typeof jsonp === 'string') {
|
|
2958
|
+
// @ts-ignore
|
|
2959
|
+
params.name = jsonp;
|
|
2937
2960
|
}
|
|
2938
|
-
delete params.jsonp;
|
|
2939
2961
|
return jsonpRetry(url, params)
|
|
2940
2962
|
.then(data => {
|
|
2941
2963
|
res.statusCode = 200;
|
|
@@ -3046,7 +3068,16 @@ function taroInterceptor(chain) {
|
|
|
3046
3068
|
return _request(chain.requestParams);
|
|
3047
3069
|
}
|
|
3048
3070
|
const link = new Link$1(taroInterceptor);
|
|
3049
|
-
const request =
|
|
3071
|
+
const request = ((...args) => {
|
|
3072
|
+
const [url = '', options = {}] = args;
|
|
3073
|
+
if (typeof url === 'string') {
|
|
3074
|
+
options.url = url;
|
|
3075
|
+
}
|
|
3076
|
+
else {
|
|
3077
|
+
Object.assign(options, url);
|
|
3078
|
+
}
|
|
3079
|
+
return link.request(options);
|
|
3080
|
+
});
|
|
3050
3081
|
const addInterceptor = link.addInterceptor.bind(link);
|
|
3051
3082
|
const cleanInterceptors = link.cleanInterceptors.bind(link);
|
|
3052
3083
|
|
|
@@ -5595,5 +5626,5 @@ taro.pxTransform = pxTransform;
|
|
|
5595
5626
|
taro.initPxTransform = initPxTransform;
|
|
5596
5627
|
taro.canIUseWebp = canIUseWebp;
|
|
5597
5628
|
|
|
5598
|
-
export { Behavior, Current, ENV_TYPE, Events, Link, addCard, addFileToFavorites, addInterceptor, addPhoneCalendar, addPhoneContact, addPhoneRepeatCalendar, addVideoToFavorites, advancedGeneralIdentify, animalClassify, arrayBufferToBase64, authPrivateMessage, authorize, authorizeForMiniProgram, base64ToArrayBuffer,
|
|
5629
|
+
export { Behavior, Current, ENV_TYPE, Events, Link, addCard, addFileToFavorites, addInterceptor, addPhoneCalendar, addPhoneContact, addPhoneRepeatCalendar, addVideoToFavorites, advancedGeneralIdentify, animalClassify, arrayBufferToBase64, authPrivateMessage, authorize, authorizeForMiniProgram, base64ToArrayBuffer, canIUseWebp, canvasGetImageData, canvasPutImageData, canvasToTempFilePath, carClassify, checkIsAddedToMyMiniProgram, checkIsOpenAccessibility, checkIsSoterEnrolledInDevice, checkIsSupportFacialRecognition, checkIsSupportSoterAuthentication, checkSession, chooseAddress, chooseContact, chooseImage, chooseInvoice, chooseInvoiceTitle, chooseLicensePlate, chooseLocation, chooseMedia, chooseMessageFile, choosePoi, chooseVideo, cleanInterceptors, clearStorage, clearStorageSync, closeBLEConnection, closeBluetoothAdapter, closeSocket, cloud, compressImage, compressVideo, connectSocket, connectWifi, createAnimation, createAudioContext, createBLEConnection, createBLEPeripheralServer, createBufferURL, createCameraContext, createCanvasContext, createInnerAudioContext, createIntersectionObserver, createInterstitialAd, createLivePlayerContext, createLivePusherContext, createMapContext, createMediaAudioPlayer, createMediaContainer, createMediaQueryObserver, createMediaRecorder, createOffscreenCanvas, createRewardedVideoAd, createSelectorQuery, createTCPSocket, createUDPSocket, createVKSession, createVideoContext, createVideoDecoder, createWebAudioContext, createWorker, taro as default, disableAlertBeforeUnload, dishClassify, downloadFile, enableAlertBeforeUnload, env, eventCenter, exitMiniProgram, exitVoIPChat, faceDetect, faceVerifyForPay, getAccountInfoSync, getApp, getAppAuthorizeSetting, getAppBaseInfo, getAppInfo, getAvailableAudioSources, getBLEDeviceCharacteristics, getBLEDeviceRSSI, getBLEDeviceServices, getBLEMTU, getBackgroundAudioManager, getBackgroundAudioPlayerState, getBackgroundFetchData, getBackgroundFetchToken, getBatteryInfo, getBatteryInfoSync, getBeacons, getBluetoothAdapterState, getBluetoothDevices, getChannelsLiveInfo, getChannelsLiveNoticeInfo, getClipboardData, getConnectedBluetoothDevices, getConnectedWifi, getCurrentInstance, getDeviceInfo, getEnterOptionsSync, getEnv, getExptInfoSync, getExtConfig, getExtConfigSync, getFileInfo, getFileSystemManager, getFuzzyLocation, getGroupEnterInfo, getHCEState, getImageInfo, getLaunchOptionsSync, getLocalIPAddress, getLocation, getLogManager, getMenuButtonBoundingClientRect, getNFCAdapter, getNetworkType, getOpenUserInfo, getPerformance, getRandomValues, getRealtimeLogManager, getRecorderManager, getSavedFileInfo, getSavedFileList, getScreenBrightness, getSelectedTextRange, getSetting, getShareInfo, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSwanId, getSystemInfo, getSystemInfoAsync, getSystemInfoSync, getSystemSetting, getUpdateManager, getUserCryptoManager, getUserInfo, getUserProfile, getVideoInfo, getWeRunData, getWifiList, getWindowInfo, hideHomeButton, hideKeyboard, hideLoading, hideNavigationBarLoading, hideShareMenu, hideTabBar, hideTabBarRedDot, hideToast, imageAudit, initFaceDetect, initPxTransform, initTabBarApis, interceptorify, interceptors, isBluetoothDevicePaired, isVKSupport, joinVoIPChat, loadFontFace, login, logoClassify, makeBluetoothPair, makePhoneCall, navigateBackMiniProgram, navigateBackSmartProgram, navigateToMiniProgram, navigateToSmartGameProgram, navigateToSmartProgram, nextTick, notifyBLECharacteristicValueChange, objectDetectIdentify, ocrBankCard, ocrDrivingLicense, ocrIdCard, ocrVehicleLicense, offAccelerometerChange, offAppHide, offAppShow, offAudioInterruptionBegin, offAudioInterruptionEnd, offBLECharacteristicValueChange, offBLEConnectionStateChange, offBLEMTUChange, offBLEPeripheralConnectionStateChanged, offBeaconServiceChange, offBeaconUpdate, offBluetoothAdapterStateChange, offBluetoothDeviceFound, offCompassChange, offCopyUrl, offDeviceMotionChange, offError, offGetWifiList, offGyroscopeChange, offHCEMessage, offKeyboardHeightChange, offLocalServiceDiscoveryStop, offLocalServiceFound, offLocalServiceLost, offLocalServiceResolveFail, offLocationChange, offLocationChangeError, offMemoryWarning, offNetworkStatusChange, offNetworkWeakChange, offPageNotFound, offThemeChange, offUnhandledRejection, offUserCaptureScreen, offVoIPChatInterrupted, offVoIPChatMembersChanged, offVoIPChatStateChanged, offVoIPVideoMembersChanged, offWifiConnected, offWindowResize, onAccelerometerChange, onAppHide, onAppShow, onAudioInterruptionBegin, onAudioInterruptionEnd, onBLECharacteristicValueChange, onBLEConnectionStateChange, onBLEMTUChange, onBLEPeripheralConnectionStateChanged, onBackgroundAudioPause, onBackgroundAudioPlay, onBackgroundAudioStop, onBackgroundFetchData, onBeaconServiceChange, onBeaconUpdate, onBluetoothAdapterStateChange, onBluetoothDeviceFound, onCompassChange, onCopyUrl, onDeviceMotionChange, onError, onGetWifiList, onGyroscopeChange, onHCEMessage, onKeyboardHeightChange, onLocalServiceDiscoveryStop, onLocalServiceFound, onLocalServiceLost, onLocalServiceResolveFail, onLocationChange, onLocationChangeError, onMemoryWarning, onNetworkStatusChange, onNetworkWeakChange, onPageNotFound, onSocketClose, onSocketError, onSocketMessage, onSocketOpen, onThemeChange, onUnhandledRejection, onUserCaptureScreen, onVoIPChatInterrupted, onVoIPChatMembersChanged, onVoIPChatSpeakersChanged, onVoIPChatStateChanged, onVoIPVideoMembersChanged, onWifiConnected, onWifiConnectedWithPartialInfo, onWindowResize, openAppAuthorizeSetting, openBluetoothAdapter, openBusinessView, openCard, openChannelsActivity, openChannelsEvent, openChannelsLive, openCustomerServiceChat, openDocument, openEmbeddedMiniProgram, openLocation, openSetting, openSystemBluetoothSetting, openVideoEditor, options, pageScrollTo, pauseBackgroundAudio, pauseVoice, plantClassify, playBackgroundAudio, playVoice, pluginLogin, preload, preloadSubPackage, previewImage, previewMedia, pxTransform, readBLECharacteristicValue, removeSavedFile, removeStorage, removeStorageSync, removeTabBarBadge, reportAnalytics, reportEvent, reportMonitor, reportPerformance, request, requestOrderPayment, requestPayment, requestPolymerPayment, requestSubscribeMessage, requirePlugin, reserveChannelsLive, revokeBufferURL, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, seekBackgroundAudio, sendHCEMessage, sendSocketMessage, setBLEMTU, setBackgroundColor, setBackgroundFetchToken, setBackgroundTextStyle, setClipboardData, setEnable1v1Chat, setEnableDebug, setInnerAudioOption, setKeepScreenOn, setNavigationBarColor, setNavigationBarTitle, setPageInfo, setScreenBrightness, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, setTopBarText, setVisualEffectOnCapture, setWifiList, setWindowSize, shareFileMessage, shareToWeRun, shareVideoMessage, showActionSheet, showLoading, showModal, showNavigationBarLoading, showRedPackage, showShareImageMenu, showShareMenu, showTabBar, showTabBarRedDot, showToast, startAccelerometer, startBeaconDiscovery, startBluetoothDevicesDiscovery, startCompass, startDeviceMotionListening, startFacialRecognitionVerify, startFacialRecognitionVerifyAndUploadVideo, startGyroscope, startHCE, startLocalServiceDiscovery, startLocationUpdate, startLocationUpdateBackground, startPullDownRefresh, startRecord, startSoterAuthentication, startWifi, stopAccelerometer, stopBackgroundAudio, stopBeaconDiscovery, stopBluetoothDevicesDiscovery, stopCompass, stopDeviceMotionListening, stopFaceDetect, stopGyroscope, stopHCE, stopLocalServiceDiscovery, stopLocationUpdate, stopPullDownRefresh, stopRecord, stopVoice, stopWifi, subscribeVoIPVideoMembers, textReview, textToAudio, updateShareMenu, updateVoIPChatMuteConfig, updateWeChatApp, uploadFile, vibrateLong, vibrateShort, writeBLECharacteristicValue };
|
|
5599
5630
|
//# sourceMappingURL=index.esm.js.map
|