@tarojs/taro-h5 3.4.0-beta.1 → 3.4.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/ad/index.js +4 -0
- package/dist/api/ai/facial.js +5 -0
- package/dist/api/ai/index.js +2 -0
- package/dist/api/ai/visual.js +3 -0
- package/dist/api/alipay/index.js +3 -0
- package/dist/api/base/crypto.js +3 -0
- package/dist/api/base/debug.js +4 -0
- package/dist/api/base/index.js +17 -0
- package/dist/api/base/performance.js +4 -0
- package/dist/api/base/system/index.js +2 -0
- package/dist/api/base/system/info.js +57 -0
- package/dist/api/base/system/network.js +63 -0
- package/dist/api/base/update.js +4 -0
- package/dist/api/base/weapp/app-event.js +18 -0
- package/dist/api/base/weapp/life-cycle.js +4 -0
- package/dist/api/canvas/CanvasContext.js +191 -0
- package/dist/api/canvas/canvasGetImageData.js +25 -0
- package/dist/api/canvas/canvasPutImageData.js +22 -0
- package/dist/api/canvas/canvasToTempFilePath.js +22 -0
- package/dist/api/canvas/createCanvasContext.js +16 -0
- package/dist/api/canvas/index.js +8 -0
- package/dist/api/cloud/index.js +21 -0
- package/dist/api/data-analysis/index.js +5 -0
- package/dist/api/device/accelerometer.js +83 -0
- package/dist/api/device/accessibility.js +3 -0
- package/dist/api/device/battery.js +4 -0
- package/dist/api/device/bluetooth-ble.js +18 -0
- package/dist/api/device/bluetooth-peripheral.js +5 -0
- package/dist/api/device/bluetooth.js +15 -0
- package/dist/api/device/calendar.js +4 -0
- package/dist/api/device/clipboard.js +65 -0
- package/dist/api/device/compass.js +64 -0
- package/dist/api/device/contact.js +4 -0
- package/dist/api/device/crypto.js +3 -0
- package/dist/api/device/gyroscope.js +6 -0
- package/dist/api/device/iBeacon.js +9 -0
- package/dist/api/device/index.js +22 -0
- package/dist/api/device/keyboard.js +6 -0
- package/dist/api/device/memory.js +4 -0
- package/dist/api/device/motion.js +81 -0
- package/dist/api/device/nfc.js +9 -0
- package/dist/api/device/phone.js +24 -0
- package/dist/api/device/scan.js +6 -0
- package/dist/api/device/screen.js +8 -0
- package/dist/api/device/vibrate.js +35 -0
- package/dist/api/device/wifi.js +12 -0
- package/dist/api/ext/index.js +4 -0
- package/dist/api/files/index.js +10 -0
- package/dist/api/framework/index.js +7 -0
- package/dist/api/index.js +24 -0
- package/dist/api/location/chooseLocation.js +93 -0
- package/dist/api/location/index.js +13 -0
- package/dist/api/location/style.css +79 -0
- package/dist/api/media/EditorContext.js +18 -0
- package/dist/api/media/audio/InnerAudioContext.js +84 -0
- package/dist/api/media/audio/index.js +15 -0
- package/dist/api/media/background-audio/BackgroundAudioManager.js +86 -0
- package/dist/api/media/background-audio/index.js +15 -0
- package/dist/api/media/camera.js +3 -0
- package/dist/api/media/image/chooseImage.js +74 -0
- package/dist/api/media/image/getImageInfo.js +31 -0
- package/dist/api/media/image/index.js +9 -0
- package/dist/api/media/image/previewImage.js +67 -0
- package/dist/api/media/index.js +12 -0
- package/dist/api/media/live.js +4 -0
- package/dist/api/media/map.js +3 -0
- package/dist/api/media/media-recorder.js +3 -0
- package/dist/api/media/recorder.js +5 -0
- package/dist/api/media/video/index.js +74 -0
- package/dist/api/media/video-decoder.js +3 -0
- package/dist/api/media/video-processing.js +3 -0
- package/dist/api/media/voip.js +16 -0
- package/dist/api/navigate/index.js +6 -0
- package/dist/api/network/download.js +124 -0
- package/dist/api/network/index.js +7 -0
- package/dist/api/network/mdns.js +12 -0
- package/dist/api/network/request/index.js +125 -0
- package/dist/api/network/tcp.js +3 -0
- package/dist/api/network/udp.js +3 -0
- package/dist/api/network/upload.js +151 -0
- package/dist/api/network/utils.js +65 -0
- package/dist/api/network/websocket/index.js +70 -0
- package/dist/api/network/websocket/socketTask.js +63 -0
- package/dist/api/open-api/account.js +3 -0
- package/dist/api/open-api/address.js +3 -0
- package/dist/api/open-api/authorize.js +4 -0
- package/dist/api/open-api/card.js +4 -0
- package/dist/api/open-api/channels-live.js +8 -0
- package/dist/api/open-api/customer-service.js +3 -0
- package/dist/api/open-api/facial.js +6 -0
- package/dist/api/open-api/favorites.js +4 -0
- package/dist/api/open-api/group.js +3 -0
- package/dist/api/open-api/index.js +18 -0
- package/dist/api/open-api/invoice.js +4 -0
- package/dist/api/open-api/license-plate.js +3 -0
- package/dist/api/open-api/login.js +5 -0
- package/dist/api/open-api/red-package.js +3 -0
- package/dist/api/open-api/settings.js +4 -0
- package/dist/api/open-api/soter.js +5 -0
- package/dist/api/open-api/subscribe-message.js +3 -0
- package/dist/api/open-api/user-info.js +4 -0
- package/dist/api/open-api/werun.js +4 -0
- package/dist/api/payment/index.js +4 -0
- package/dist/api/route/index.js +3 -0
- package/dist/api/share/index.js +12 -0
- package/dist/api/storage/background-fetch.js +6 -0
- package/dist/api/storage/index.js +157 -0
- package/dist/api/swan/index.js +26 -0
- package/dist/api/taro.js +47 -0
- package/dist/api/ui/animation/index.js +288 -0
- package/dist/api/ui/background.js +4 -0
- package/dist/api/ui/custom-component.js +3 -0
- package/dist/api/ui/fonts.js +3 -0
- package/dist/api/ui/index.js +12 -0
- package/dist/api/ui/interaction/actionSheet.js +188 -0
- package/dist/api/ui/interaction/index.js +268 -0
- package/dist/api/ui/interaction/modal.js +207 -0
- package/dist/api/ui/interaction/toast.js +195 -0
- package/dist/api/ui/menu.js +3 -0
- package/dist/api/ui/navigation-bar/index.js +42 -0
- package/dist/api/ui/pull-down-refresh.js +26 -0
- package/dist/api/ui/scroll/index.js +83 -0
- package/dist/api/ui/sticky.js +3 -0
- package/dist/api/ui/tab-bar.js +282 -0
- package/dist/api/ui/window.js +31 -0
- package/dist/api/utils/handler.js +80 -0
- package/dist/api/utils/index.js +172 -0
- package/dist/api/worker/index.js +3 -0
- package/dist/api/wxml/index.js +6 -0
- package/dist/api/wxml/nodesRef.js +42 -0
- package/dist/api/wxml/selectorQuery.js +201 -0
- package/dist/index.cjs.js +4756 -6934
- package/dist/index.js +4 -10767
- package/dist/taroApis.js +1 -1
- package/dist/types/type.js +2 -0
- package/package.json +11 -13
- package/src/api/canvas/CanvasContext.ts +36 -33
- package/src/api/canvas/createCanvasContext.ts +2 -2
- package/src/api/cloud/index.ts +4 -0
- package/src/api/location/chooseLocation.ts +2 -2
- package/src/api/media/{editor.ts → EditorContext.ts} +0 -0
- package/src/api/media/audio/InnerAudioContext.ts +98 -0
- package/src/api/media/audio/index.ts +1 -86
- package/src/api/media/background-audio/BackgroundAudioManager.ts +103 -0
- package/src/api/media/{background-audio.ts → background-audio/index.ts} +7 -2
- package/src/api/media/image/previewImage.ts +4 -25
- package/src/api/media/index.ts +0 -1
- package/src/api/network/download.ts +5 -5
- package/src/api/network/upload.ts +6 -6
- package/src/api/network/websocket/index.ts +1 -1
- package/src/api/ui/animation/index.ts +11 -12
- package/src/api/ui/interaction/index.ts +12 -10
- package/src/api/ui/navigation-bar/index.ts +2 -2
- package/src/api/ui/scroll/index.ts +3 -3
- package/src/api/utils/index.ts +34 -13
- package/src/api/wxml/nodesRef.ts +10 -3
- package/src/api/wxml/selectorQuery.ts +68 -23
- package/src/index.ts +2 -2
package/dist/taroApis.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = new Set(["
|
|
1
|
+
module.exports = new Set(["addCard","addFileToFavorites","addInterceptor","addPhoneCalendar","addPhoneContact","addPhoneRepeatCalendar","addVideoToFavorites","advancedGeneralIdentify","animalClassify","arrayBufferToBase64","authPrivateMessage","authorize","authorizeForMiniProgram","base64ToArrayBuffer","canIUse","canvasGetImageData","canvasPutImageData","canvasToTempFilePath","carClassify","checkIsOpenAccessibility","checkIsSoterEnrolledInDevice","checkIsSupportFacialRecognition","checkIsSupportSoterAuthentication","checkSession","chooseAddress","chooseContact","chooseImage","chooseInvoice","chooseInvoiceTitle","chooseLicensePlate","chooseLocation","chooseMedia","chooseMessageFile","choosePoi","chooseVideo","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","createMediaRecorder","createOffscreenCanvas","createRewardedVideoAd","createSelectorQuery","createTCPSocket","createUDPSocket","createVKSession","createVideoContext","createVideoDecoder","createWebAudioContext","createWorker","disableAlertBeforeUnload","dishClassify","downloadFile","drawCanvas","enableAlertBeforeUnload","exitMiniProgram","exitVoIPChat","faceDetect","faceVerifyForPay","getAccountInfoSync","getApp","getAvailableAudioSources","getBLEDeviceCharacteristics","getBLEDeviceRSSI","getBLEDeviceServices","getBLEMTU","getBackgroundAudioManager","getBackgroundAudioPlayerState","getBackgroundFetchData","getBackgroundFetchToken","getBatteryInfo","getBatteryInfoSync","getBeacons","getBluetoothAdapterState","getBluetoothDevices","getChannelsLiveInfo","getChannelsLiveNoticeInfo","getClipboardData","getConnectedBluetoothDevices","getConnectedWifi","getCurrentInstance","getCurrentPages","getEnterOptionsSync","getExptInfoSync","getExtConfig","getExtConfigSync","getFileInfo","getFileSystemManager","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","getSystemInfoSync","getUpdateManager","getUserCryptoManager","getUserInfo","getUserProfile","getVideoInfo","getWeRunData","getWifiList","hideHomeButton","hideKeyboard","hideLoading","hideNavigationBarLoading","hideShareMenu","hideTabBar","hideTabBarRedDot","hideToast","imageAudit","initFaceDetect","initTabBarApis","isBluetoothDevicePaired","joinVoIPChat","loadFontFace","login","logoClassify","makeBluetoothPair","makePhoneCall","navigateBack","navigateBackMiniProgram","navigateBackSmartProgram","navigateTo","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","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","onPageNotFound","onSocketClose","onSocketError","onSocketMessage","onSocketOpen","onThemeChange","onUnhandledRejection","onUserCaptureScreen","onVoIPChatInterrupted","onVoIPChatMembersChanged","onVoIPChatSpeakersChanged","onVoIPChatStateChanged","onVoIPVideoMembersChanged","onWifiConnected","onWindowResize","openBluetoothAdapter","openCard","openChannelsActivity","openChannelsEvent","openChannelsLive","openCustomerServiceChat","openDocument","openEmbeddedMiniProgram","openLocation","openSetting","openVideoEditor","pageScrollTo","pauseBackgroundAudio","pauseVoice","plantClassify","playBackgroundAudio","playVoice","pluginLogin","preloadSubPackage","previewImage","previewMedia","reLaunch","readBLECharacteristicValue","redirectTo","removeSavedFile","removeStorage","removeStorageSync","removeTabBarBadge","reportAnalytics","reportEvent","reportMonitor","reportPerformance","request","requestOrderPayment","requestPayment","requestPolymerPayment","requestSubscribeMessage","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","switchTab","textReview","textToAudio","updateShareMenu","updateVoIPChatMuteConfig","updateWeChatApp","uploadFile","vibrateLong","vibrateShort","writeBLECharacteristicValue"])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/taro-h5",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"description": "Taro h5 framework",
|
|
5
5
|
"main:h5": "dist/index.js",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -10,17 +10,15 @@
|
|
|
10
10
|
"src",
|
|
11
11
|
"index.js"
|
|
12
12
|
],
|
|
13
|
-
"sideEffects":
|
|
14
|
-
"*.scss",
|
|
15
|
-
"*.css",
|
|
16
|
-
"./src/taro/index.js"
|
|
17
|
-
],
|
|
13
|
+
"sideEffects": false,
|
|
18
14
|
"scripts": {
|
|
19
15
|
"test": "jest",
|
|
16
|
+
"test:ci": "jest -i --coverage false",
|
|
20
17
|
"test:dev": "jest --watch",
|
|
21
18
|
"test:coverage": "jest --coverage",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
19
|
+
"copy:assets": "copy src/**/*.css dist",
|
|
20
|
+
"build": "rollup -c && npm run copy:assets && tsc",
|
|
21
|
+
"dev": "tsc -w & npm run copy:assets"
|
|
24
22
|
},
|
|
25
23
|
"repository": {
|
|
26
24
|
"type": "git",
|
|
@@ -32,14 +30,14 @@
|
|
|
32
30
|
"author": "O2Team",
|
|
33
31
|
"license": "MIT",
|
|
34
32
|
"dependencies": {
|
|
35
|
-
"@tarojs/api": "3.4.
|
|
36
|
-
"@tarojs/router": "3.4.
|
|
37
|
-
"@tarojs/runtime": "3.4.
|
|
38
|
-
"@tarojs/taro": "3.4.
|
|
33
|
+
"@tarojs/api": "3.4.1",
|
|
34
|
+
"@tarojs/router": "3.4.1",
|
|
35
|
+
"@tarojs/runtime": "3.4.1",
|
|
36
|
+
"@tarojs/taro": "3.4.1",
|
|
39
37
|
"base64-js": "^1.3.0",
|
|
40
38
|
"jsonp-retry": "^1.0.3",
|
|
41
39
|
"mobile-detect": "^1.4.2",
|
|
42
40
|
"whatwg-fetch": "^3.4.0"
|
|
43
41
|
},
|
|
44
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "a2437215b1966fd0b6dd09311bcb4fd894a871d0"
|
|
45
43
|
}
|
|
@@ -16,12 +16,17 @@ export class CanvasContext implements Taro.CanvasContext {
|
|
|
16
16
|
__raw__: CanvasRenderingContext2D
|
|
17
17
|
actions: IAction[] = []
|
|
18
18
|
|
|
19
|
+
constructor (canvas, ctx) {
|
|
20
|
+
this.canvas = canvas
|
|
21
|
+
this.ctx = ctx
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
set ctx (e: CanvasRenderingContext2D) {
|
|
20
25
|
this.__raw__ = e
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
get ctx () {
|
|
24
|
-
return this.__raw__
|
|
29
|
+
return this.__raw__ || {}
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
canvas: HTMLCanvasElement
|
|
@@ -30,13 +35,11 @@ export class CanvasContext implements Taro.CanvasContext {
|
|
|
30
35
|
this.actions.length = 0
|
|
31
36
|
}
|
|
32
37
|
|
|
33
|
-
protected enqueueActions (func: IAction['func']) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
})
|
|
39
|
-
}
|
|
38
|
+
protected enqueueActions (func: IAction['func'], ...args) {
|
|
39
|
+
this.actions.push({
|
|
40
|
+
func,
|
|
41
|
+
args
|
|
42
|
+
})
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
set fillStyle (e) { this.enqueueActions(() => { this.ctx.fillStyle = e }) }
|
|
@@ -82,13 +85,13 @@ export class CanvasContext implements Taro.CanvasContext {
|
|
|
82
85
|
get filter () { return this.ctx.filter }
|
|
83
86
|
/** 小程序文档中不包括 ↑↑↑ */
|
|
84
87
|
|
|
85
|
-
arc
|
|
86
|
-
arcTo
|
|
87
|
-
beginPath
|
|
88
|
-
bezierCurveTo
|
|
89
|
-
clearRect
|
|
90
|
-
clip
|
|
91
|
-
closePath
|
|
88
|
+
arc (...args) { return this.enqueueActions(this.ctx.arc, ...args) }
|
|
89
|
+
arcTo (...args) { return this.enqueueActions(this.ctx.arcTo, ...args) }
|
|
90
|
+
beginPath (...args) { return this.enqueueActions(this.ctx.beginPath, ...args) }
|
|
91
|
+
bezierCurveTo (...args) { return this.enqueueActions(this.ctx.bezierCurveTo, ...args) }
|
|
92
|
+
clearRect (...args) { return this.enqueueActions(this.ctx.clearRect, ...args) }
|
|
93
|
+
clip (...args) { return this.enqueueActions(this.ctx.clip, ...args) }
|
|
94
|
+
closePath (...args) { return this.enqueueActions(this.ctx.closePath, ...args) }
|
|
92
95
|
|
|
93
96
|
createPattern (image: string, repetition: keyof Taro.CanvasContext.repetition): void {
|
|
94
97
|
return this.createPattern(image, repetition)
|
|
@@ -139,17 +142,17 @@ export class CanvasContext implements Taro.CanvasContext {
|
|
|
139
142
|
})
|
|
140
143
|
}
|
|
141
144
|
|
|
142
|
-
fill
|
|
143
|
-
fillRect
|
|
144
|
-
fillText
|
|
145
|
-
lineTo
|
|
146
|
-
moveTo
|
|
147
|
-
quadraticCurveTo
|
|
148
|
-
rect
|
|
149
|
-
restore
|
|
150
|
-
rotate
|
|
151
|
-
save
|
|
152
|
-
scale
|
|
145
|
+
fill (...args) { return this.enqueueActions(this.ctx.fill, ...args) }
|
|
146
|
+
fillRect (...args) { return this.enqueueActions(this.ctx.fillRect, ...args) }
|
|
147
|
+
fillText (...args) { return this.enqueueActions(this.ctx.fillText, ...args) }
|
|
148
|
+
lineTo (...args) { return this.enqueueActions(this.ctx.lineTo, ...args) }
|
|
149
|
+
moveTo (...args) { return this.enqueueActions(this.ctx.moveTo, ...args) }
|
|
150
|
+
quadraticCurveTo (...args) { return this.enqueueActions(this.ctx.quadraticCurveTo, ...args) }
|
|
151
|
+
rect (...args) { return this.enqueueActions(this.ctx.rect, ...args) }
|
|
152
|
+
restore (...args) { return this.enqueueActions(this.ctx.restore, ...args) }
|
|
153
|
+
rotate (...args) { return this.enqueueActions(this.ctx.rotate, ...args) }
|
|
154
|
+
save (...args) { return this.enqueueActions(this.ctx.save, ...args) }
|
|
155
|
+
scale (...args) { return this.enqueueActions(this.ctx.scale, ...args) }
|
|
153
156
|
|
|
154
157
|
setFillStyle (color: string | CanvasGradient): void {
|
|
155
158
|
this.enqueueActions(() => { this.ctx.fillStyle = color })
|
|
@@ -207,15 +210,15 @@ export class CanvasContext implements Taro.CanvasContext {
|
|
|
207
210
|
this.textBaseline = TextBaseLineMap[textBaseline] || 'alphabetic'
|
|
208
211
|
}
|
|
209
212
|
|
|
210
|
-
setTransform
|
|
211
|
-
stroke
|
|
212
|
-
strokeRect
|
|
213
|
-
strokeText
|
|
214
|
-
transform
|
|
215
|
-
translate
|
|
213
|
+
setTransform (...args) { return this.enqueueActions(this.ctx.setTransform, ...args) }
|
|
214
|
+
stroke (...args) { return this.enqueueActions(this.ctx.stroke, ...args) }
|
|
215
|
+
strokeRect (...args) { return this.enqueueActions(this.ctx.strokeRect, ...args) }
|
|
216
|
+
strokeText (...args) { return this.enqueueActions(this.ctx.strokeText, ...args) }
|
|
217
|
+
transform (...args) { return this.enqueueActions(this.ctx.transform, ...args) }
|
|
218
|
+
translate (...args) { return this.enqueueActions(this.ctx.translate, ...args) }
|
|
216
219
|
|
|
217
220
|
measureText (text: string): TextMetrics {
|
|
218
|
-
return this.measureText(text)
|
|
221
|
+
return this.ctx.measureText(text)
|
|
219
222
|
}
|
|
220
223
|
|
|
221
224
|
createCircularGradient (x: number, y: number, r: number): CanvasGradient {
|
|
@@ -6,10 +6,10 @@ import { CanvasContext } from './CanvasContext'
|
|
|
6
6
|
* 创建 canvas 的绘图上下文 CanvasContext 对象
|
|
7
7
|
*/
|
|
8
8
|
export const createCanvasContext: typeof Taro.createCanvasContext = (canvasId, inst) => {
|
|
9
|
-
const context = new CanvasContext()
|
|
10
9
|
const el = findDOM(inst) as HTMLElement
|
|
11
10
|
const canvas = el?.querySelector(`canvas[canvas-id="${canvasId}"]`) as HTMLCanvasElement
|
|
12
|
-
const ctx = canvas?.getContext('2d')
|
|
11
|
+
const ctx = canvas?.getContext('2d') as CanvasRenderingContext2D
|
|
12
|
+
const context = new CanvasContext(canvas, ctx)
|
|
13
13
|
if (!ctx) return context
|
|
14
14
|
context.canvas = canvas
|
|
15
15
|
context.ctx = ctx
|
package/src/api/cloud/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export class cloud implements Taro.cloud {
|
|
|
8
8
|
|
|
9
9
|
CloudID = temporarilyNotSupport('cloud.CloudID')
|
|
10
10
|
|
|
11
|
+
// @ts-ignore
|
|
11
12
|
callFunction = temporarilyNotSupport('cloud.callFunction')
|
|
12
13
|
|
|
13
14
|
// @ts-ignore
|
|
@@ -16,12 +17,15 @@ export class cloud implements Taro.cloud {
|
|
|
16
17
|
// @ts-ignore
|
|
17
18
|
downloadFile = temporarilyNotSupport('cloud.downloadFile')
|
|
18
19
|
|
|
20
|
+
// @ts-ignore
|
|
19
21
|
getTempFileURL = temporarilyNotSupport('cloud.getTempFileURL')
|
|
20
22
|
|
|
23
|
+
// @ts-ignore
|
|
21
24
|
deleteFile = temporarilyNotSupport('cloud.deleteFile')
|
|
22
25
|
|
|
23
26
|
// @ts-ignore
|
|
24
27
|
database = temporarilyNotSupport('cloud.database')
|
|
25
28
|
|
|
29
|
+
// @ts-ignore
|
|
26
30
|
callContainer = temporarilyNotSupport('cloud.callContainer')
|
|
27
31
|
}
|
|
@@ -28,13 +28,13 @@ function createLocationChooser (handler, key = LOCATION_APIKEY) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
function back () {
|
|
31
|
-
handler({ errMsg: 'cancel' })
|
|
32
31
|
hide()
|
|
32
|
+
handler({ errMsg: 'cancel' })
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function submit () {
|
|
36
|
-
handler()
|
|
37
36
|
hide()
|
|
37
|
+
handler()
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
function remove () {
|
|
File without changes
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import Taro from '@tarojs/api'
|
|
2
|
+
import { permanentlyNotSupport } from '../../utils'
|
|
3
|
+
import { CallbackManager } from '../../utils/handler'
|
|
4
|
+
|
|
5
|
+
export class InnerAudioContext implements Taro.InnerAudioContext {
|
|
6
|
+
Instance?: HTMLAudioElement
|
|
7
|
+
errorStack: CallbackManager
|
|
8
|
+
stopStack: CallbackManager
|
|
9
|
+
__startTime = 0
|
|
10
|
+
|
|
11
|
+
constructor () {
|
|
12
|
+
this.Instance = new Audio()
|
|
13
|
+
this.errorStack = new CallbackManager()
|
|
14
|
+
this.stopStack = new CallbackManager()
|
|
15
|
+
|
|
16
|
+
Taro.eventCenter.on('__taroRouterChange', () => { this.stop() })
|
|
17
|
+
this.onPlay(() => {
|
|
18
|
+
if (this.currentTime !== this.startTime) {
|
|
19
|
+
this.seek(this.startTime)
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
set autoplay (e) { this.setProperty('autoplay', e) }
|
|
25
|
+
get autoplay () { return this.Instance?.autoplay || false }
|
|
26
|
+
get buffered () { return this.Instance?.buffered.length || 0 }
|
|
27
|
+
get currentTime () { return this.Instance?.currentTime || 0 }
|
|
28
|
+
get duration () { return this.Instance?.duration || 0 }
|
|
29
|
+
set loop (e) { this.setProperty('loop', e) }
|
|
30
|
+
get loop () { return this.Instance?.loop || false }
|
|
31
|
+
get paused () { return this.Instance?.paused || true }
|
|
32
|
+
set src (e) { this.setProperty('src', e) }
|
|
33
|
+
get src () { return this.Instance?.src || '' }
|
|
34
|
+
set volume (e) { this.setProperty('volume', e) }
|
|
35
|
+
get volume () { return this.Instance?.volume || 0 }
|
|
36
|
+
set playbackRate (e) { this.setProperty('playbackRate', e) }
|
|
37
|
+
get playbackRate () { return this.Instance?.playbackRate || 0 }
|
|
38
|
+
set obeyMuteSwitch (_e) { permanentlyNotSupport('InnerAudioContext.obeyMuteSwitch')() }
|
|
39
|
+
get obeyMuteSwitch () { return true }
|
|
40
|
+
set startTime (e) { this.__startTime = e }
|
|
41
|
+
get startTime () { return this.__startTime || 0 }
|
|
42
|
+
set referrerPolicy (e) { this.Instance?.setAttribute('referrerpolicy', e) }
|
|
43
|
+
get referrerPolicy () { return this.Instance?.getAttribute('referrerpolicy') || 'origin' }
|
|
44
|
+
|
|
45
|
+
private setProperty (key: string, value: unknown) {
|
|
46
|
+
if (this.Instance) {
|
|
47
|
+
this.Instance[key] = value
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
play = () => this.Instance?.play()
|
|
52
|
+
|
|
53
|
+
pause = () => this.Instance?.pause()
|
|
54
|
+
|
|
55
|
+
stop = () => {
|
|
56
|
+
this.pause()
|
|
57
|
+
this.seek(0)
|
|
58
|
+
this.stopStack.trigger()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
seek = (position: number) => {
|
|
62
|
+
if (this.Instance) {
|
|
63
|
+
this.Instance.currentTime = position
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @TODO destroy得并不干净
|
|
69
|
+
*/
|
|
70
|
+
destroy = () => {
|
|
71
|
+
this.stop()
|
|
72
|
+
if (this.Instance) {
|
|
73
|
+
document.body.removeChild(this.Instance)
|
|
74
|
+
this.Instance = undefined
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
onCanplay = (callback = () => {}) => this.Instance?.addEventListener('canplay', callback)
|
|
79
|
+
onPlay = (callback = () => {}) => this.Instance?.addEventListener('play', callback)
|
|
80
|
+
onPause = (callback = () => {}) => this.Instance?.addEventListener('pause', callback)
|
|
81
|
+
onStop = (callback = () => {}) => this.stopStack.add(callback)
|
|
82
|
+
onEnded = (callback = () => {}) => this.Instance?.addEventListener('ended', callback)
|
|
83
|
+
onTimeUpdate = (callback = () => {}) => this.Instance?.addEventListener('timeupdate', callback)
|
|
84
|
+
onError = (callback?: ((res: Taro.InnerAudioContext.onErrorDetail) => void)) => this.errorStack.add(callback)
|
|
85
|
+
onWaiting = (callback = () => {}) => this.Instance?.addEventListener('waiting', callback)
|
|
86
|
+
onSeeking = (callback = () => {}) => this.Instance?.addEventListener('seeking', callback)
|
|
87
|
+
onSeeked = (callback = () => {}) => this.Instance?.addEventListener('seeked', callback)
|
|
88
|
+
offCanplay = (callback = () => {}) => this.Instance?.removeEventListener('canplay', callback)
|
|
89
|
+
offPlay = (callback = () => {}) => this.Instance?.removeEventListener('play', callback)
|
|
90
|
+
offPause = (callback = () => {}) => this.Instance?.removeEventListener('pause', callback)
|
|
91
|
+
offStop = (callback = () => {}) => this.stopStack.remove(callback)
|
|
92
|
+
offEnded = (callback = () => {}) => this.Instance?.removeEventListener('ended', callback)
|
|
93
|
+
offTimeUpdate = (callback = () => {}) => this.Instance?.removeEventListener('timeupdate', callback)
|
|
94
|
+
offError = (callback = () => {}) => this.errorStack.remove(callback)
|
|
95
|
+
offWaiting = (callback = () => {}) => this.Instance?.removeEventListener('waiting', callback)
|
|
96
|
+
offSeeking = (callback = () => {}) => this.Instance?.removeEventListener('seeking', callback)
|
|
97
|
+
offSeeked = (callback = () => {}) => this.Instance?.removeEventListener('seeked', callback)
|
|
98
|
+
}
|
|
@@ -1,93 +1,8 @@
|
|
|
1
1
|
import Taro from '@tarojs/api'
|
|
2
2
|
import { temporarilyNotSupport } from '../../utils'
|
|
3
|
-
import {
|
|
3
|
+
import { InnerAudioContext } from './InnerAudioContext'
|
|
4
4
|
|
|
5
5
|
// 音频
|
|
6
|
-
class InnerAudioContext implements Taro.InnerAudioContext {
|
|
7
|
-
Instance?: HTMLAudioElement
|
|
8
|
-
errorStack: CallbackManager
|
|
9
|
-
stopStack: CallbackManager
|
|
10
|
-
|
|
11
|
-
constructor () {
|
|
12
|
-
this.Instance = new Audio()
|
|
13
|
-
this.errorStack = new CallbackManager()
|
|
14
|
-
this.stopStack = new CallbackManager()
|
|
15
|
-
|
|
16
|
-
Taro.eventCenter.on('__taroRouterChange', () => { this.stop() })
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
set autoplay (e) { this.setProperty('autoplay', e) }
|
|
20
|
-
get autoplay () { return this.Instance?.autoplay || false }
|
|
21
|
-
get buffered () { return this.Instance?.buffered.length || 0 }
|
|
22
|
-
get currentTime () { return this.Instance?.currentTime || 0 }
|
|
23
|
-
get duration () { return this.Instance?.duration || 0 }
|
|
24
|
-
set loop (e) { this.setProperty('loop', e) }
|
|
25
|
-
get loop () { return this.Instance?.loop || false }
|
|
26
|
-
get paused () { return this.Instance?.paused || true }
|
|
27
|
-
set src (e) { this.setProperty('src', e) }
|
|
28
|
-
get src () { return this.Instance?.src || '' }
|
|
29
|
-
set volume (e) { this.setProperty('volume', e) }
|
|
30
|
-
get volume () { return this.Instance?.volume || 0 }
|
|
31
|
-
set playbackRate (e) { this.setProperty('playbackRate', e) }
|
|
32
|
-
get playbackRate () { return this.Instance?.volume || 0 }
|
|
33
|
-
get obeyMuteSwitch () { return true }
|
|
34
|
-
set startTime (e) { this.setProperty('startTime', e) }
|
|
35
|
-
get startTime () { return this.Instance?.volume || 0 }
|
|
36
|
-
|
|
37
|
-
private setProperty (key: string, value: unknown) {
|
|
38
|
-
if (this.Instance) {
|
|
39
|
-
this.Instance[key] = value
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
play = () => this.Instance?.play()
|
|
44
|
-
|
|
45
|
-
pause = () => this.Instance?.pause()
|
|
46
|
-
|
|
47
|
-
stop = () => {
|
|
48
|
-
this.pause()
|
|
49
|
-
this.seek(0)
|
|
50
|
-
this.stopStack.trigger()
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
seek = (position: number) => {
|
|
54
|
-
if (this.Instance) {
|
|
55
|
-
this.Instance.currentTime = position
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* @TODO destroy得并不干净
|
|
61
|
-
*/
|
|
62
|
-
destroy = () => {
|
|
63
|
-
this.stop()
|
|
64
|
-
if (this.Instance) {
|
|
65
|
-
document.body.removeChild(this.Instance)
|
|
66
|
-
this.Instance = undefined
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
onCanplay = (callback = () => {}) => this.Instance?.addEventListener('oncanplay', callback)
|
|
71
|
-
onPlay = (callback = () => {}) => this.Instance?.addEventListener('onplay', callback)
|
|
72
|
-
onPause = (callback = () => {}) => this.Instance?.addEventListener('onpause', callback)
|
|
73
|
-
onStop = (callback = () => {}) => this.stopStack.add(callback)
|
|
74
|
-
onEnded = (callback = () => {}) => this.Instance?.addEventListener('onended', callback)
|
|
75
|
-
onTimeUpdate = (callback = () => {}) => this.Instance?.addEventListener('ontimeUpdate', callback)
|
|
76
|
-
onError = (callback?: ((res: Taro.InnerAudioContext.onErrorDetail) => void)) => this.errorStack.add(callback)
|
|
77
|
-
onWaiting = (callback = () => {}) => this.Instance?.addEventListener('onwaiting', callback)
|
|
78
|
-
onSeeking = (callback = () => {}) => this.Instance?.addEventListener('onseeking', callback)
|
|
79
|
-
onSeeked = (callback = () => {}) => this.Instance?.addEventListener('onseeked', callback)
|
|
80
|
-
offCanplay = (callback = () => {}) => this.Instance?.removeEventListener('offcanplay', callback)
|
|
81
|
-
offPlay = (callback = () => {}) => this.Instance?.removeEventListener('offplay', callback)
|
|
82
|
-
offPause = (callback = () => {}) => this.Instance?.removeEventListener('offpause', callback)
|
|
83
|
-
offStop = (callback = () => {}) => this.stopStack.remove(callback)
|
|
84
|
-
offEnded = (callback = () => {}) => this.Instance?.removeEventListener('offended', callback)
|
|
85
|
-
offTimeUpdate = (callback = () => {}) => this.Instance?.removeEventListener('offtimeUpdate', callback)
|
|
86
|
-
offError = (callback = () => {}) => this.errorStack.remove(callback)
|
|
87
|
-
offWaiting = (callback = () => {}) => this.Instance?.removeEventListener('offwaiting', callback)
|
|
88
|
-
offSeeking = (callback = () => {}) => this.Instance?.removeEventListener('offseeking', callback)
|
|
89
|
-
offSeeked = (callback = () => {}) => this.Instance?.removeEventListener('offseeked', callback)
|
|
90
|
-
}
|
|
91
6
|
|
|
92
7
|
export const stopVoice = temporarilyNotSupport('stopVoice')
|
|
93
8
|
export const setInnerAudioOption = temporarilyNotSupport('setInnerAudioOption')
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import Taro from '@tarojs/api'
|
|
2
|
+
import { permanentlyNotSupport } from '../../utils'
|
|
3
|
+
import { CallbackManager } from '../../utils/handler'
|
|
4
|
+
|
|
5
|
+
export class BackgroundAudioManager implements Taro.BackgroundAudioManager {
|
|
6
|
+
Instance?: HTMLAudioElement
|
|
7
|
+
errorStack: CallbackManager
|
|
8
|
+
stopStack: CallbackManager
|
|
9
|
+
__startTime = 0
|
|
10
|
+
|
|
11
|
+
constructor () {
|
|
12
|
+
this.Instance = new Audio()
|
|
13
|
+
this.errorStack = new CallbackManager()
|
|
14
|
+
this.stopStack = new CallbackManager()
|
|
15
|
+
this.Instance.autoplay = true
|
|
16
|
+
this.onPlay(() => {
|
|
17
|
+
if (this.currentTime !== this.startTime) {
|
|
18
|
+
this.seek(this.startTime)
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
set src (e) { this.setProperty('src', e) }
|
|
24
|
+
get src () { return this.Instance?.src || '' }
|
|
25
|
+
set startTime (e) { this.__startTime = e }
|
|
26
|
+
get startTime () { return this.__startTime || 0 }
|
|
27
|
+
set title (e) { this.dataset('title', e) }
|
|
28
|
+
get title () { return this.Instance?.dataset.title || '' }
|
|
29
|
+
set epname (e) { this.dataset('epname', e) }
|
|
30
|
+
get epname () { return this.Instance?.dataset.epname || '' }
|
|
31
|
+
set singer (e) { this.dataset('singer', e) }
|
|
32
|
+
get singer () { return this.Instance?.dataset.singer || '' }
|
|
33
|
+
set coverImgUrl (e) { this.dataset('coverImgUrl', e) }
|
|
34
|
+
get coverImgUrl () { return this.Instance?.dataset.coverImgUrl || '' }
|
|
35
|
+
set webUrl (e) { this.dataset('webUrl', e) }
|
|
36
|
+
get webUrl () { return this.Instance?.dataset.webUrl || '' }
|
|
37
|
+
set protocol (e) { this.dataset('protocol', e) }
|
|
38
|
+
get protocol () { return this.Instance?.dataset.protocol || '' }
|
|
39
|
+
set playbackRate (e) { this.setProperty('playbackRate', e) }
|
|
40
|
+
get playbackRate () { return this.Instance?.playbackRate || 0 }
|
|
41
|
+
get duration () { return this.Instance?.duration || 0 }
|
|
42
|
+
get currentTime () { return this.Instance?.currentTime || 0 }
|
|
43
|
+
get paused () { return this.Instance?.paused || false }
|
|
44
|
+
get buffered () { return this.Instance?.buffered.length || 0 }
|
|
45
|
+
set referrerPolicy (e) { this.Instance?.setAttribute('referrerpolicy', e) }
|
|
46
|
+
get referrerPolicy () { return this.Instance?.getAttribute('referrerpolicy') || 'origin' }
|
|
47
|
+
|
|
48
|
+
private setProperty (key: string, value: unknown) {
|
|
49
|
+
if (this.Instance) {
|
|
50
|
+
this.Instance[key] = value
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private dataset (key: string, value: string) {
|
|
55
|
+
if (this.Instance) {
|
|
56
|
+
this.Instance.dataset[key] = value
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
play = () => this.Instance?.play()
|
|
61
|
+
|
|
62
|
+
pause = () => this.Instance?.pause()
|
|
63
|
+
|
|
64
|
+
seek = (position: number) => {
|
|
65
|
+
if (this.Instance) {
|
|
66
|
+
this.Instance.currentTime = position
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
stop = () => {
|
|
71
|
+
this.pause()
|
|
72
|
+
this.seek(0)
|
|
73
|
+
this.stopStack.trigger()
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
onCanplay = (callback = () => {}) => this.Instance?.addEventListener('canplay', callback)
|
|
77
|
+
onWaiting = (callback = () => {}) => this.Instance?.addEventListener('waiting', callback)
|
|
78
|
+
onError = (callback?: ((res: Taro.InnerAudioContext.onErrorDetail) => void)) => this.errorStack.add(callback)
|
|
79
|
+
onPlay = (callback = () => {}) => this.Instance?.addEventListener('play', callback)
|
|
80
|
+
onPause = (callback = () => {}) => this.Instance?.addEventListener('pause', callback)
|
|
81
|
+
onSeeking = (callback = () => {}) => this.Instance?.addEventListener('seeking', callback)
|
|
82
|
+
onSeeked = (callback = () => {}) => this.Instance?.addEventListener('seeked', callback)
|
|
83
|
+
|
|
84
|
+
onEnded = (callback = () => {}) => this.Instance?.addEventListener('ended', callback)
|
|
85
|
+
onStop = (callback = () => {}) => this.stopStack.add(callback)
|
|
86
|
+
onTimeUpdate = (callback = () => {}) => this.Instance?.addEventListener('timeupdate', callback)
|
|
87
|
+
onPrev = permanentlyNotSupport('BackgroundAudioManager.onPrev')
|
|
88
|
+
onNext = permanentlyNotSupport('BackgroundAudioManager.onNext')
|
|
89
|
+
|
|
90
|
+
offCanplay = (callback = () => {}) => this.Instance?.removeEventListener('canplay', callback)
|
|
91
|
+
offWaiting = (callback = () => {}) => this.Instance?.removeEventListener('waiting', callback)
|
|
92
|
+
offError = (callback = () => {}) => this.errorStack.remove(callback)
|
|
93
|
+
offPlay = (callback = () => {}) => this.Instance?.removeEventListener('play', callback)
|
|
94
|
+
offPause = (callback = () => {}) => this.Instance?.removeEventListener('pause', callback)
|
|
95
|
+
offSeeking = (callback = () => {}) => this.Instance?.removeEventListener('seeking', callback)
|
|
96
|
+
offSeeked = (callback = () => {}) => this.Instance?.removeEventListener('seeked', callback)
|
|
97
|
+
|
|
98
|
+
offEnded = (callback = () => {}) => this.Instance?.removeEventListener('ended', callback)
|
|
99
|
+
offStop = (callback = () => {}) => this.stopStack.remove(callback)
|
|
100
|
+
offTimeUpdate = (callback = () => {}) => this.Instance?.removeEventListener('timeupdate', callback)
|
|
101
|
+
offPrev = permanentlyNotSupport('BackgroundAudioManager.offPrev')
|
|
102
|
+
offNext = permanentlyNotSupport('BackgroundAudioManager.offNext')
|
|
103
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { temporarilyNotSupport } from '
|
|
1
|
+
import { temporarilyNotSupport } from '../../utils'
|
|
2
|
+
import { BackgroundAudioManager } from './BackgroundAudioManager'
|
|
2
3
|
|
|
3
4
|
// 背景音频
|
|
4
5
|
export const stopBackgroundAudio = temporarilyNotSupport('stopBackgroundAudio')
|
|
@@ -9,4 +10,8 @@ export const onBackgroundAudioStop = temporarilyNotSupport('onBackgroundAudioSto
|
|
|
9
10
|
export const onBackgroundAudioPlay = temporarilyNotSupport('onBackgroundAudioPlay')
|
|
10
11
|
export const onBackgroundAudioPause = temporarilyNotSupport('onBackgroundAudioPause')
|
|
11
12
|
export const getBackgroundAudioPlayerState = temporarilyNotSupport('getBackgroundAudioPlayerState')
|
|
12
|
-
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 获取全局唯一的背景音频管理器
|
|
16
|
+
*/
|
|
17
|
+
export const getBackgroundAudioManager = () => new BackgroundAudioManager()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Taro from '@tarojs/
|
|
1
|
+
import Taro from '@tarojs/api'
|
|
2
2
|
|
|
3
3
|
import { shouldBeObject } from '../../utils'
|
|
4
4
|
import { MethodHandler } from '../../utils/handler'
|
|
@@ -14,23 +14,12 @@ export const previewImage: typeof Taro.previewImage = async (options) => {
|
|
|
14
14
|
function loadImage (url: string, loadFail: typeof fail): Promise<Node> {
|
|
15
15
|
return new Promise((resolve) => {
|
|
16
16
|
const item = document.createElement('taro-swiper-item-core')
|
|
17
|
-
item.style.cssText =
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: start;
|
|
20
|
-
justify-content: center;
|
|
21
|
-
overflow-y: scroll;
|
|
22
|
-
`
|
|
17
|
+
item.style.cssText = 'display:flex;align-items:start;justify-content:center;overflow-y:scroll;'
|
|
23
18
|
const image = new Image()
|
|
24
19
|
image.style.maxWidth = '100%'
|
|
25
20
|
image.src = url
|
|
26
21
|
const div = document.createElement('div')
|
|
27
|
-
div.style.cssText =
|
|
28
|
-
display: flex;
|
|
29
|
-
align-items: center;
|
|
30
|
-
justify-content: center;
|
|
31
|
-
max-width: 100%;
|
|
32
|
-
min-height: 100%;
|
|
33
|
-
`
|
|
22
|
+
div.style.cssText = 'display:flex;align-items:center;justify-content:center;max-width:100%;min-height:100%;'
|
|
34
23
|
div.appendChild(image)
|
|
35
24
|
item.appendChild(div)
|
|
36
25
|
// Note: 等待图片加载完后返回,会导致轮播被卡住
|
|
@@ -55,17 +44,7 @@ export const previewImage: typeof Taro.previewImage = async (options) => {
|
|
|
55
44
|
const handle = new MethodHandler({ name: 'previewImage', success, fail, complete })
|
|
56
45
|
const container = document.createElement('div')
|
|
57
46
|
container.classList.add('preview-image')
|
|
58
|
-
container.style.cssText =
|
|
59
|
-
position: fixed;
|
|
60
|
-
top: 0;
|
|
61
|
-
left: 0;
|
|
62
|
-
z-index: 1050;
|
|
63
|
-
width: 100%;
|
|
64
|
-
height: 100%;
|
|
65
|
-
overflow: hidden;
|
|
66
|
-
outline: 0;
|
|
67
|
-
background-color: #111;
|
|
68
|
-
`
|
|
47
|
+
container.style.cssText = 'position:fixed;top:0;left:0;z-index:1050;width:100%;height:100%;overflow:hidden;outline:0;background-color:#111;'
|
|
69
48
|
container.addEventListener('click', () => {
|
|
70
49
|
container.remove()
|
|
71
50
|
})
|