@tarojs/taro-h5 3.6.24 → 3.6.26-alpha.1
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/index.js +2 -1
- package/dist/api/index.js.map +1 -1
- package/dist/api/location/getLocation.js +2 -2
- package/dist/api/location/getLocation.js.map +1 -1
- package/dist/api/location/index.d.ts +2 -7
- package/dist/api/location/index.js +2 -8
- package/dist/api/location/index.js.map +1 -1
- package/dist/api/location/locationChange.d.ts +7 -0
- package/dist/api/location/locationChange.js +130 -0
- package/dist/api/location/locationChange.js.map +1 -0
- package/dist/api/location/utils.d.ts +2 -0
- package/dist/api/location/utils.js +4 -0
- package/dist/api/location/utils.js.map +1 -0
- package/dist/api/ui/navigation-bar/index.d.ts +8 -2
- package/dist/api/ui/navigation-bar/index.js +20 -4
- package/dist/api/ui/navigation-bar/index.js.map +1 -1
- package/dist/index.cjs.d.ts +17 -10
- package/dist/index.cjs.js +150 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.d.ts +17 -10
- package/dist/index.esm.js +151 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/handler.d.ts +2 -0
- package/dist/utils/handler.js +4 -0
- package/dist/utils/handler.js.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.esm.d.ts
CHANGED
|
@@ -348,17 +348,10 @@ declare const getFileInfo: (option?: {}, ...args: any[]) => Promise<Partial<Taro
|
|
|
348
348
|
declare const getApp: typeof Taro.getApp;
|
|
349
349
|
// 自定义组件
|
|
350
350
|
declare const getCurrentInstance: () => Taro.getCurrentInstance.Current;
|
|
351
|
-
// 位置
|
|
352
|
-
declare const stopLocationUpdate: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
353
351
|
declare const startLocationUpdateBackground: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
354
|
-
declare const startLocationUpdate: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
355
352
|
declare const openLocation: (options?: Partial<{
|
|
356
353
|
scale: number;
|
|
357
354
|
}>, ...args: any[]) => Promise<any>;
|
|
358
|
-
declare const onLocationChangeError: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
359
|
-
declare const onLocationChange: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
360
|
-
declare const offLocationChangeError: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
361
|
-
declare const offLocationChange: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
362
355
|
declare const getLocation: (options?: Partial<Taro.getLocation.Option>, ...args: any[]) => Promise<Taro.getLocation.SuccessCallbackResult>;
|
|
363
356
|
declare const choosePoi: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
364
357
|
declare const getFuzzyLocation: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
@@ -366,6 +359,12 @@ declare const getFuzzyLocation: (option?: {}, ...args: any[]) => Promise<Partial
|
|
|
366
359
|
* 打开地图选择位置。
|
|
367
360
|
*/
|
|
368
361
|
declare const chooseLocation: typeof Taro.chooseLocation;
|
|
362
|
+
declare function onLocationChange(callback: Taro.onLocationChange.Callback): void;
|
|
363
|
+
declare function offLocationChange(callback: Taro.onLocationChange.Callback): void;
|
|
364
|
+
declare function onLocationChangeError(callback: Taro.onLocationChange.Callback): void;
|
|
365
|
+
declare function offLocationChangeError(callback: Taro.onLocationChange.Callback): void;
|
|
366
|
+
declare const stopLocationUpdate: (options?: Partial<import("@tarojs/taro").stopLocationUpdate.Option>, ...args: any[]) => Promise<TaroGeneral.CallbackResult>;
|
|
367
|
+
declare const startLocationUpdate: (options?: Partial<import("@tarojs/taro").startLocationUpdate.Option>, ...args: any[]) => Promise<TaroGeneral.CallbackResult>;
|
|
369
368
|
// 音频
|
|
370
369
|
declare const stopVoice: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
371
370
|
declare const setInnerAudioOption: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
@@ -396,6 +395,8 @@ declare class CallbackManager<T extends unknown[] = unknown[]> {
|
|
|
396
395
|
count: () => number;
|
|
397
396
|
/** 触发回调 */
|
|
398
397
|
trigger: (...args: T) => void;
|
|
398
|
+
/** 清空所有回调 */
|
|
399
|
+
clear: () => void;
|
|
399
400
|
}
|
|
400
401
|
declare class BackgroundAudioManager implements Taro.BackgroundAudioManager {
|
|
401
402
|
Instance?: HTMLAudioElement;
|
|
@@ -781,13 +782,19 @@ declare const disableAlertBeforeUnload: (option?: {}, ...args: any[]) => Promise
|
|
|
781
782
|
// 菜单
|
|
782
783
|
declare const getMenuButtonBoundingClientRect: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
783
784
|
// 导航栏
|
|
784
|
-
|
|
785
|
+
/**
|
|
786
|
+
* 展示导航栏 loading 状态
|
|
787
|
+
*/
|
|
788
|
+
declare function showNavigationBarLoading(options?: Taro.showNavigationBarLoading.Option): Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
785
789
|
declare function setNavigationBarTitle(options?: Taro.setNavigationBarTitle.Option): Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
786
790
|
/**
|
|
787
791
|
* 设置页面导航条颜色
|
|
788
792
|
*/
|
|
789
793
|
declare const setNavigationBarColor: typeof Taro.setNavigationBarColor;
|
|
790
|
-
|
|
794
|
+
/**
|
|
795
|
+
* 隐藏导航栏 loading 状态
|
|
796
|
+
*/
|
|
797
|
+
declare function hideNavigationBarLoading(options?: Taro.hideNavigationBarLoading.Option): Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
791
798
|
declare const hideHomeButton: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
792
799
|
/**
|
|
793
800
|
* 开始下拉刷新。调用后触发下拉刷新动画,效果与用户手动下拉刷新一致。
|
|
@@ -887,5 +894,5 @@ declare class NodesRef implements Taro.NodesRef {
|
|
|
887
894
|
declare const createSelectorQuery: typeof Taro.createSelectorQuery;
|
|
888
895
|
declare const createIntersectionObserver: typeof Taro.createIntersectionObserver;
|
|
889
896
|
declare const createMediaQueryObserver: typeof Taro.createMediaQueryObserver;
|
|
890
|
-
export { taro as default, taro, createRewardedVideoAd, createInterstitialAd, stopFaceDetect, initFaceDetect, faceDetect, getInferenceEnvInfo, createInferenceSession, isVKSupport, createVKSession, getOpenUserInfo, tradePay, env, arrayBufferToBase64, base64ToArrayBuffer, getUserCryptoManager, setEnableDebug, getRealtimeLogManager, getLogManager, reportPerformance, getPerformance, preloadWebview, preloadSkylineView, preloadAssets, openSystemBluetoothSetting, openAppAuthorizeSetting, getWindowInfo, getSystemSetting, getDeviceInfo, getAppBaseInfo, getAppAuthorizeSetting, getSystemInfoSync, getSystemInfoAsync, getSystemInfo, getSkylineInfoSync, getSkylineInfo, getRendererUserAgent, updateWeChatApp, getUpdateManager, onUnhandledRejection, onThemeChange, onPageNotFound, onLazyLoadError, onError, onAudioInterruptionEnd, onAudioInterruptionBegin, onAppShow, onAppHide, offUnhandledRejection, offThemeChange, offPageNotFound, offLazyLoadError, 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, onScreenRecordingStateChanged, offScreenRecordingStateChanged, getScreenRecordingState, sendSms, vibrateShort, vibrateLong, stopWifi, startWifi, setWifiList, onWifiConnectedWithPartialInfo, onWifiConnected, onGetWifiList, offWifiConnectedWithPartialInfo, offWifiConnected, offGetWifiList, getWifiList, getConnectedWifi, connectWifi, getExtConfigSync, getExtConfig, saveFileToDisk, saveFile, removeSavedFile, openDocument, getSavedFileList, getSavedFileInfo, getFileSystemManager, getFileInfo, getApp, getCurrentInstance,
|
|
897
|
+
export { taro as default, taro, createRewardedVideoAd, createInterstitialAd, stopFaceDetect, initFaceDetect, faceDetect, getInferenceEnvInfo, createInferenceSession, isVKSupport, createVKSession, getOpenUserInfo, tradePay, env, arrayBufferToBase64, base64ToArrayBuffer, getUserCryptoManager, setEnableDebug, getRealtimeLogManager, getLogManager, reportPerformance, getPerformance, preloadWebview, preloadSkylineView, preloadAssets, openSystemBluetoothSetting, openAppAuthorizeSetting, getWindowInfo, getSystemSetting, getDeviceInfo, getAppBaseInfo, getAppAuthorizeSetting, getSystemInfoSync, getSystemInfoAsync, getSystemInfo, getSkylineInfoSync, getSkylineInfo, getRendererUserAgent, updateWeChatApp, getUpdateManager, onUnhandledRejection, onThemeChange, onPageNotFound, onLazyLoadError, onError, onAudioInterruptionEnd, onAudioInterruptionBegin, onAppShow, onAppHide, offUnhandledRejection, offThemeChange, offPageNotFound, offLazyLoadError, 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, onScreenRecordingStateChanged, offScreenRecordingStateChanged, getScreenRecordingState, sendSms, vibrateShort, vibrateLong, stopWifi, startWifi, setWifiList, onWifiConnectedWithPartialInfo, onWifiConnected, onGetWifiList, offWifiConnectedWithPartialInfo, offWifiConnected, offGetWifiList, getWifiList, getConnectedWifi, connectWifi, getExtConfigSync, getExtConfig, saveFileToDisk, saveFile, removeSavedFile, openDocument, getSavedFileList, getSavedFileInfo, getFileSystemManager, getFileInfo, getApp, getCurrentInstance, startLocationUpdateBackground, openLocation, getLocation, choosePoi, getFuzzyLocation, chooseLocation, offLocationChange, offLocationChangeError, onLocationChange, onLocationChangeError, startLocationUpdate, stopLocationUpdate, 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, editImage, cropImage, createLivePusherContext, createLivePlayerContext, createMapContext, createMediaRecorder, stopRecord, startRecord, getRecorderManager, saveVideoToPhotosAlbum, openVideoEditor, getVideoInfo, createVideoContext, compressVideo, chooseMedia, chooseVideo, createVideoDecoder, createMediaContainer, updateVoIPChatMuteConfig, subscribeVoIPVideoMembers, setEnable1v1Chat, onVoIPVideoMembersChanged, onVoIPChatStateChanged, onVoIPChatSpeakersChanged, onVoIPChatMembersChanged, onVoIPChatInterrupted, offVoIPChatSpeakersChanged, offVoIPVideoMembersChanged, offVoIPChatStateChanged, offVoIPChatMembersChanged, offVoIPChatInterrupted, joinVoIPChat, join1v1Chat, 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, SocketTask, getAccountInfoSync, chooseAddress, authorizeForMiniProgram, authorize, openCard, addCard, reserveChannelsLive, openChannelsUserProfile, openChannelsLive, openChannelsEvent, openChannelsActivity, getChannelsShareKey, getChannelsLiveNoticeInfo, getChannelsLiveInfo, openCustomerServiceChat, requestDeviceVoIP, getDeviceVoIPList, checkIsSupportFacialRecognition, startFacialRecognitionVerify, startFacialRecognitionVerifyAndUploadVideo, faceVerifyForPay, addVideoToFavorites, addFileToFavorites, getGroupEnterInfo, chooseInvoiceTitle, chooseInvoice, chooseLicensePlate, pluginLogin, login, checkSession, checkIsAddedToMyMiniProgram, requirePrivacyAuthorize, openPrivacyContract, onNeedPrivacyAuthorization, getPrivacySetting, showRedPackage, openSetting, getSetting, startSoterAuthentication, checkIsSupportSoterAuthentication, checkIsSoterEnrolledInDevice, requestSubscribeMessage, requestSubscribeDeviceMessage, getUserProfile, getUserInfo, shareToWeRun, getWeRunData, requestPayment, requestPluginPayment, requestOrderPayment, openQzonePublish, getQQRunData, setOfficialDress, setCustomDress, updateQQApp, addRecentColorSign, getGuildInfo, applyAddToMyApps, isAddedToMyApps, updateShareMenu, showShareMenu, showShareImageMenu, shareVideoMessage, shareFileMessage, onCopyUrl, offCopyUrl, hideShareMenu, getShareInfo, authPrivateMessage, setStorageSync, setStorage, revokeBufferURL, removeStorageSync, removeStorage, getStorageSync, getStorageInfoSync, getStorageInfo, getStorage, createBufferURL, clearStorageSync, clearStorage, batchSetStorageSync, batchSetStorage, batchGetStorageSync, batchGetStorage, setBackgroundFetchToken, onBackgroundFetchData, getBackgroundFetchToken, getBackgroundFetchData, createCacheManager, 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, checkIsPictureInPictureActive, createWorker, createSelectorQuery, createIntersectionObserver, createMediaQueryObserver, NodesRef, Behavior, canIUseWebp, Current, ENV_TYPE, eventCenter, Events, getAppInfo, getEnv, history, initPxTransform, interceptorify, interceptors, Link, options, preload, pxTransform, requirePlugin };
|
|
891
898
|
export { getCurrentPages, navigateBack, navigateTo, redirectTo, reLaunch, switchTab } from "@tarojs/router";
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Taro from '@tarojs/api';
|
|
2
|
-
import { setTitle, setNavigationBarStyle, history, navigateBack, navigateTo, reLaunch, redirectTo, getCurrentPages, switchTab } from '@tarojs/router';
|
|
2
|
+
import { setNavigationBarLoading, setTitle, setNavigationBarStyle, history, navigateBack, navigateTo, reLaunch, redirectTo, getCurrentPages, switchTab } from '@tarojs/router';
|
|
3
3
|
export { getCurrentPages, history, navigateBack, navigateTo, reLaunch, redirectTo, switchTab } from '@tarojs/router';
|
|
4
4
|
import { isFunction, toKebabCase, PLATFORM_TYPE } from '@tarojs/shared';
|
|
5
5
|
import { hooks, Current as Current$1, getCurrentPage, getHomePage, eventCenter as eventCenter$1 } from '@tarojs/runtime';
|
|
@@ -91,6 +91,10 @@ class CallbackManager {
|
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
};
|
|
94
|
+
/** 清空所有回调 */
|
|
95
|
+
this.clear = () => {
|
|
96
|
+
this.callbacks = [];
|
|
97
|
+
};
|
|
94
98
|
}
|
|
95
99
|
}
|
|
96
100
|
|
|
@@ -141,7 +145,7 @@ function findDOM(inst) {
|
|
|
141
145
|
}
|
|
142
146
|
const page = Current$1.page;
|
|
143
147
|
const path = page === null || page === void 0 ? void 0 : page.path;
|
|
144
|
-
const msg = '
|
|
148
|
+
const msg = '没有找到已经加载了的页面,请在页面加载完成后使用此 API。';
|
|
145
149
|
if (path == null) {
|
|
146
150
|
throw new Error(msg);
|
|
147
151
|
}
|
|
@@ -2762,6 +2766,8 @@ const getApp = function () {
|
|
|
2762
2766
|
// 自定义组件
|
|
2763
2767
|
const getCurrentInstance = Taro.getCurrentInstance;
|
|
2764
2768
|
|
|
2769
|
+
const isGeolocationSupported = () => !!navigator.geolocation;
|
|
2770
|
+
|
|
2765
2771
|
const getLocationByW3CApi = (options) => {
|
|
2766
2772
|
var _a;
|
|
2767
2773
|
// 断言 options 必须是 Object
|
|
@@ -2787,8 +2793,7 @@ const getLocationByW3CApi = (options) => {
|
|
|
2787
2793
|
});
|
|
2788
2794
|
}
|
|
2789
2795
|
// 判断当前浏览器是否支持位置API
|
|
2790
|
-
|
|
2791
|
-
if (!geolocationSupported) {
|
|
2796
|
+
if (!isGeolocationSupported()) {
|
|
2792
2797
|
return handle.fail({
|
|
2793
2798
|
errMsg: 'The current browser does not support this feature'
|
|
2794
2799
|
});
|
|
@@ -2954,18 +2959,135 @@ const chooseLocation = ({ success, fail, complete, mapOpts } = {}) => {
|
|
|
2954
2959
|
});
|
|
2955
2960
|
};
|
|
2956
2961
|
|
|
2957
|
-
|
|
2958
|
-
const
|
|
2962
|
+
const _successCbManager = new CallbackManager();
|
|
2963
|
+
const _errorCbManager = new CallbackManager();
|
|
2964
|
+
let _watchID = -1;
|
|
2965
|
+
function onLocationChange(callback) {
|
|
2966
|
+
_successCbManager.add(callback);
|
|
2967
|
+
}
|
|
2968
|
+
function offLocationChange(callback) {
|
|
2969
|
+
if (callback && typeof callback === 'function') {
|
|
2970
|
+
_successCbManager.remove(callback);
|
|
2971
|
+
}
|
|
2972
|
+
else if (callback === undefined) {
|
|
2973
|
+
_successCbManager.clear();
|
|
2974
|
+
}
|
|
2975
|
+
else {
|
|
2976
|
+
console.warn('offLocationChange failed');
|
|
2977
|
+
}
|
|
2978
|
+
}
|
|
2979
|
+
function onLocationChangeError(callback) {
|
|
2980
|
+
_errorCbManager.add(callback);
|
|
2981
|
+
}
|
|
2982
|
+
function offLocationChangeError(callback) {
|
|
2983
|
+
if (callback && typeof callback === 'function') {
|
|
2984
|
+
_errorCbManager.remove(callback);
|
|
2985
|
+
}
|
|
2986
|
+
else if (callback === undefined) {
|
|
2987
|
+
_errorCbManager.clear();
|
|
2988
|
+
}
|
|
2989
|
+
else {
|
|
2990
|
+
console.warn('offLocationChangeError failed');
|
|
2991
|
+
}
|
|
2992
|
+
}
|
|
2993
|
+
/**
|
|
2994
|
+
* 开始监听位置信息
|
|
2995
|
+
* @param opts
|
|
2996
|
+
* @returns
|
|
2997
|
+
*/
|
|
2998
|
+
function startLocationUpdateByW3CApi(opts) {
|
|
2999
|
+
// 断言 options 必须是 Object
|
|
3000
|
+
const isObject = shouldBeObject(opts);
|
|
3001
|
+
if (!isObject.flag) {
|
|
3002
|
+
const res = { errMsg: `startLocationUpdate:fail ${isObject.msg}` };
|
|
3003
|
+
console.error(res.errMsg);
|
|
3004
|
+
return Promise.reject(res);
|
|
3005
|
+
}
|
|
3006
|
+
const { success, fail, complete } = opts;
|
|
3007
|
+
const handle = new MethodHandler({ name: 'startLocationUpdate', success, fail, complete });
|
|
3008
|
+
// 判断当前浏览器是否支持位置API
|
|
3009
|
+
if (!isGeolocationSupported()) {
|
|
3010
|
+
return handle.fail({
|
|
3011
|
+
errMsg: 'The current browser does not support this feature'
|
|
3012
|
+
});
|
|
3013
|
+
}
|
|
3014
|
+
try {
|
|
3015
|
+
if (_watchID > -1) {
|
|
3016
|
+
console.error('startLocationUpdate:fail');
|
|
3017
|
+
return handle.fail();
|
|
3018
|
+
}
|
|
3019
|
+
else {
|
|
3020
|
+
_watchID = navigator.geolocation.watchPosition(({ coords }) => {
|
|
3021
|
+
const { latitude, longitude, altitude, accuracy, speed } = coords;
|
|
3022
|
+
_successCbManager.trigger({
|
|
3023
|
+
accuracy,
|
|
3024
|
+
altitude,
|
|
3025
|
+
horizontalAccuracy: 0,
|
|
3026
|
+
verticalAccuracy: 0,
|
|
3027
|
+
latitude,
|
|
3028
|
+
longitude,
|
|
3029
|
+
speed,
|
|
3030
|
+
});
|
|
3031
|
+
}, err => {
|
|
3032
|
+
_errorCbManager.trigger({
|
|
3033
|
+
errMsg: 'Watch Position error',
|
|
3034
|
+
err
|
|
3035
|
+
});
|
|
3036
|
+
}, {
|
|
3037
|
+
timeout: 10,
|
|
3038
|
+
maximumAge: 0,
|
|
3039
|
+
enableHighAccuracy: true,
|
|
3040
|
+
});
|
|
3041
|
+
return handle.success();
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
3044
|
+
catch (error) {
|
|
3045
|
+
return handle.fail();
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
/**
|
|
3049
|
+
* 停止监听位置信息
|
|
3050
|
+
* @param opts
|
|
3051
|
+
* @returns
|
|
3052
|
+
*/
|
|
3053
|
+
function stopLocationUpdateByW3CApi(opts) {
|
|
3054
|
+
const isObject = shouldBeObject(opts);
|
|
3055
|
+
if (!isObject.flag) {
|
|
3056
|
+
const res = { errMsg: `stopLocationUpdate:fail ${isObject.msg}` };
|
|
3057
|
+
console.error(res.errMsg);
|
|
3058
|
+
return Promise.reject(res);
|
|
3059
|
+
}
|
|
3060
|
+
const { success, fail, complete } = opts;
|
|
3061
|
+
const handle = new MethodHandler({ name: 'stopLocationUpdate', success, fail, complete });
|
|
3062
|
+
// 判断当前浏览器是否支持位置API
|
|
3063
|
+
if (!isGeolocationSupported()) {
|
|
3064
|
+
return handle.fail({
|
|
3065
|
+
errMsg: 'The current browser does not support this feature'
|
|
3066
|
+
});
|
|
3067
|
+
}
|
|
3068
|
+
try {
|
|
3069
|
+
navigator.geolocation.clearWatch(_watchID);
|
|
3070
|
+
_watchID = -1;
|
|
3071
|
+
return handle.success();
|
|
3072
|
+
}
|
|
3073
|
+
catch (error) {
|
|
3074
|
+
return handle.fail();
|
|
3075
|
+
}
|
|
3076
|
+
}
|
|
3077
|
+
const stopLocationUpdate = /* @__PURE__ */ processOpenApi({
|
|
3078
|
+
name: 'stopLocationUpdate',
|
|
3079
|
+
standardMethod: stopLocationUpdateByW3CApi
|
|
3080
|
+
});
|
|
3081
|
+
const startLocationUpdate = /* @__PURE__ */ processOpenApi({
|
|
3082
|
+
name: 'startLocationUpdate',
|
|
3083
|
+
standardMethod: startLocationUpdateByW3CApi
|
|
3084
|
+
});
|
|
3085
|
+
|
|
2959
3086
|
const startLocationUpdateBackground = /* @__PURE__ */ temporarilyNotSupport('startLocationUpdateBackground');
|
|
2960
|
-
const startLocationUpdate = /* @__PURE__ */ temporarilyNotSupport('startLocationUpdate');
|
|
2961
3087
|
const openLocation = /* @__PURE__ */ processOpenApi({
|
|
2962
3088
|
name: 'openLocation',
|
|
2963
3089
|
defaultOptions: { scale: 18 }
|
|
2964
3090
|
});
|
|
2965
|
-
const onLocationChangeError = /* @__PURE__ */ temporarilyNotSupport('onLocationChangeError');
|
|
2966
|
-
const onLocationChange = /* @__PURE__ */ temporarilyNotSupport('onLocationChange');
|
|
2967
|
-
const offLocationChangeError = /* @__PURE__ */ temporarilyNotSupport('offLocationChangeError');
|
|
2968
|
-
const offLocationChange = /* @__PURE__ */ temporarilyNotSupport('offLocationChange');
|
|
2969
3091
|
const choosePoi = /* @__PURE__ */ temporarilyNotSupport('choosePoi');
|
|
2970
3092
|
const getFuzzyLocation = /* @__PURE__ */ temporarilyNotSupport('getFuzzyLocation');
|
|
2971
3093
|
|
|
@@ -3718,7 +3840,15 @@ const loadFontFace = (options) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
3718
3840
|
const getMenuButtonBoundingClientRect = /* @__PURE__ */ temporarilyNotSupport('getMenuButtonBoundingClientRect');
|
|
3719
3841
|
|
|
3720
3842
|
// 导航栏
|
|
3721
|
-
|
|
3843
|
+
/**
|
|
3844
|
+
* 展示导航栏 loading 状态
|
|
3845
|
+
*/
|
|
3846
|
+
function showNavigationBarLoading(options = {}) {
|
|
3847
|
+
const { success, fail, complete } = options;
|
|
3848
|
+
const handle = new MethodHandler({ name: 'showNavigationBarLoading', success, fail, complete });
|
|
3849
|
+
setNavigationBarLoading(true);
|
|
3850
|
+
return handle.success();
|
|
3851
|
+
}
|
|
3722
3852
|
function setNavigationBarTitle(options) {
|
|
3723
3853
|
// options must be an Object
|
|
3724
3854
|
const isObject = shouldBeObject(options);
|
|
@@ -3754,7 +3884,15 @@ const setNavigationBarColor = (options) => {
|
|
|
3754
3884
|
setNavigationBarStyle({ frontColor, backgroundColor });
|
|
3755
3885
|
return handle.success();
|
|
3756
3886
|
};
|
|
3757
|
-
|
|
3887
|
+
/**
|
|
3888
|
+
* 隐藏导航栏 loading 状态
|
|
3889
|
+
*/
|
|
3890
|
+
function hideNavigationBarLoading(options = {}) {
|
|
3891
|
+
const { success, fail, complete } = options;
|
|
3892
|
+
const handle = new MethodHandler({ name: 'hideNavigationBarLoading', success, fail, complete });
|
|
3893
|
+
setNavigationBarLoading(false);
|
|
3894
|
+
return handle.success();
|
|
3895
|
+
}
|
|
3758
3896
|
const hideHomeButton = /* @__PURE__ */ temporarilyNotSupport('hideHomeButton');
|
|
3759
3897
|
|
|
3760
3898
|
/**
|