@tarojs/taro-h5 3.4.0 → 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/index.cjs.js CHANGED
@@ -85,28 +85,52 @@ function serializeParams$1(params) {
85
85
  function temporarilyNotSupport(apiName) {
86
86
  return () => {
87
87
  const errMsg = `暂时不支持 API ${apiName}`;
88
- console.error(errMsg);
89
- return Promise.reject({
90
- errMsg
91
- });
88
+ if (process.env.NODE_ENV !== 'production') {
89
+ console.error(errMsg);
90
+ return Promise.reject({
91
+ errMsg
92
+ });
93
+ }
94
+ else {
95
+ console.warn(errMsg);
96
+ return Promise.resolve({
97
+ errMsg
98
+ });
99
+ }
92
100
  };
93
101
  }
94
102
  function weixinCorpSupport(apiName) {
95
103
  return () => {
96
104
  const errMsg = `h5端仅在微信公众号中支持 API ${apiName}`;
97
- console.error(errMsg);
98
- return Promise.reject({
99
- errMsg
100
- });
105
+ if (process.env.NODE_ENV !== 'production') {
106
+ console.error(errMsg);
107
+ return Promise.reject({
108
+ errMsg
109
+ });
110
+ }
111
+ else {
112
+ console.warn(errMsg);
113
+ return Promise.resolve({
114
+ errMsg
115
+ });
116
+ }
101
117
  };
102
118
  }
103
119
  function permanentlyNotSupport(apiName) {
104
120
  return () => {
105
121
  const errMsg = `不支持 API ${apiName}`;
106
- console.error(errMsg);
107
- return Promise.reject({
108
- errMsg
109
- });
122
+ if (process.env.NODE_ENV !== 'production') {
123
+ console.error(errMsg);
124
+ return Promise.reject({
125
+ errMsg
126
+ });
127
+ }
128
+ else {
129
+ console.warn(errMsg);
130
+ return Promise.resolve({
131
+ errMsg
132
+ });
133
+ }
110
134
  };
111
135
  }
112
136
  function isFunction$1(obj) {
@@ -1696,7 +1720,7 @@ class CanvasContext {
1696
1720
  transform(...args) { return this.enqueueActions(this.ctx.transform, ...args); }
1697
1721
  translate(...args) { return this.enqueueActions(this.ctx.translate, ...args); }
1698
1722
  measureText(text) {
1699
- return this.measureText(text);
1723
+ return this.ctx.measureText(text);
1700
1724
  }
1701
1725
  createCircularGradient(x, y, r) {
1702
1726
  const radialGradient = this.ctx.createRadialGradient(x, y, 0, x, y, r);
@@ -1796,15 +1820,19 @@ class cloud {
1796
1820
  constructor() {
1797
1821
  this.init = temporarilyNotSupport('cloud.init');
1798
1822
  this.CloudID = temporarilyNotSupport('cloud.CloudID');
1823
+ // @ts-ignore
1799
1824
  this.callFunction = temporarilyNotSupport('cloud.callFunction');
1800
1825
  // @ts-ignore
1801
1826
  this.uploadFile = temporarilyNotSupport('cloud.uploadFile');
1802
1827
  // @ts-ignore
1803
1828
  this.downloadFile = temporarilyNotSupport('cloud.downloadFile');
1829
+ // @ts-ignore
1804
1830
  this.getTempFileURL = temporarilyNotSupport('cloud.getTempFileURL');
1831
+ // @ts-ignore
1805
1832
  this.deleteFile = temporarilyNotSupport('cloud.deleteFile');
1806
1833
  // @ts-ignore
1807
1834
  this.database = temporarilyNotSupport('cloud.database');
1835
+ // @ts-ignore
1808
1836
  this.callContainer = temporarilyNotSupport('cloud.callContainer');
1809
1837
  }
1810
1838
  }
@@ -2598,9 +2626,9 @@ const offLocationChange = temporarilyNotSupport('offLocationChange');
2598
2626
  const getLocation = processOpenApi('getLocation');
2599
2627
  const choosePoi = temporarilyNotSupport('choosePoi');
2600
2628
 
2601
- // 音频
2602
2629
  class InnerAudioContext {
2603
2630
  constructor() {
2631
+ this.__startTime = 0;
2604
2632
  this.play = () => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.play(); };
2605
2633
  this.pause = () => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.pause(); };
2606
2634
  this.stop = () => {
@@ -2647,6 +2675,11 @@ class InnerAudioContext {
2647
2675
  this.errorStack = new CallbackManager();
2648
2676
  this.stopStack = new CallbackManager();
2649
2677
  Taro__default['default'].eventCenter.on('__taroRouterChange', () => { this.stop(); });
2678
+ this.onPlay(() => {
2679
+ if (this.currentTime !== this.startTime) {
2680
+ this.seek(this.startTime);
2681
+ }
2682
+ });
2650
2683
  }
2651
2684
  set autoplay(e) { this.setProperty('autoplay', e); }
2652
2685
  get autoplay() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.autoplay) || false; }
@@ -2661,16 +2694,21 @@ class InnerAudioContext {
2661
2694
  set volume(e) { this.setProperty('volume', e); }
2662
2695
  get volume() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.volume) || 0; }
2663
2696
  set playbackRate(e) { this.setProperty('playbackRate', e); }
2664
- get playbackRate() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.volume) || 0; }
2697
+ get playbackRate() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.playbackRate) || 0; }
2698
+ set obeyMuteSwitch(_e) { permanentlyNotSupport('InnerAudioContext.obeyMuteSwitch')(); }
2665
2699
  get obeyMuteSwitch() { return true; }
2666
- set startTime(e) { this.setProperty('startTime', e); }
2667
- get startTime() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.volume) || 0; }
2700
+ set startTime(e) { this.__startTime = e; }
2701
+ get startTime() { return this.__startTime || 0; }
2702
+ set referrerPolicy(e) { var _a; (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.setAttribute('referrerpolicy', e); }
2703
+ get referrerPolicy() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.getAttribute('referrerpolicy')) || 'origin'; }
2668
2704
  setProperty(key, value) {
2669
2705
  if (this.Instance) {
2670
2706
  this.Instance[key] = value;
2671
2707
  }
2672
2708
  }
2673
- }
2709
+ }
2710
+
2711
+ // 音频
2674
2712
  const stopVoice = temporarilyNotSupport('stopVoice');
2675
2713
  const setInnerAudioOption = temporarilyNotSupport('setInnerAudioOption');
2676
2714
  const playVoice = temporarilyNotSupport('playVoice');
@@ -2684,6 +2722,91 @@ const createMediaAudioPlayer = temporarilyNotSupport('createMediaAudioPlayer');
2684
2722
  const createInnerAudioContext = () => new InnerAudioContext();
2685
2723
  const createAudioContext = temporarilyNotSupport('createAudioContext');
2686
2724
 
2725
+ class BackgroundAudioManager {
2726
+ constructor() {
2727
+ this.__startTime = 0;
2728
+ this.play = () => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.play(); };
2729
+ this.pause = () => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.pause(); };
2730
+ this.seek = (position) => {
2731
+ if (this.Instance) {
2732
+ this.Instance.currentTime = position;
2733
+ }
2734
+ };
2735
+ this.stop = () => {
2736
+ this.pause();
2737
+ this.seek(0);
2738
+ this.stopStack.trigger();
2739
+ };
2740
+ this.onCanplay = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.addEventListener('canplay', callback); };
2741
+ this.onWaiting = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.addEventListener('waiting', callback); };
2742
+ this.onError = (callback) => this.errorStack.add(callback);
2743
+ this.onPlay = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.addEventListener('play', callback); };
2744
+ this.onPause = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.addEventListener('pause', callback); };
2745
+ this.onSeeking = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.addEventListener('seeking', callback); };
2746
+ this.onSeeked = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.addEventListener('seeked', callback); };
2747
+ this.onEnded = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.addEventListener('ended', callback); };
2748
+ this.onStop = (callback = () => { }) => this.stopStack.add(callback);
2749
+ this.onTimeUpdate = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.addEventListener('timeupdate', callback); };
2750
+ this.onPrev = permanentlyNotSupport('BackgroundAudioManager.onPrev');
2751
+ this.onNext = permanentlyNotSupport('BackgroundAudioManager.onNext');
2752
+ this.offCanplay = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.removeEventListener('canplay', callback); };
2753
+ this.offWaiting = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.removeEventListener('waiting', callback); };
2754
+ this.offError = (callback = () => { }) => this.errorStack.remove(callback);
2755
+ this.offPlay = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.removeEventListener('play', callback); };
2756
+ this.offPause = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.removeEventListener('pause', callback); };
2757
+ this.offSeeking = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.removeEventListener('seeking', callback); };
2758
+ this.offSeeked = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.removeEventListener('seeked', callback); };
2759
+ this.offEnded = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.removeEventListener('ended', callback); };
2760
+ this.offStop = (callback = () => { }) => this.stopStack.remove(callback);
2761
+ this.offTimeUpdate = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.removeEventListener('timeupdate', callback); };
2762
+ this.offPrev = permanentlyNotSupport('BackgroundAudioManager.offPrev');
2763
+ this.offNext = permanentlyNotSupport('BackgroundAudioManager.offNext');
2764
+ this.Instance = new Audio();
2765
+ this.errorStack = new CallbackManager();
2766
+ this.stopStack = new CallbackManager();
2767
+ this.Instance.autoplay = true;
2768
+ this.onPlay(() => {
2769
+ if (this.currentTime !== this.startTime) {
2770
+ this.seek(this.startTime);
2771
+ }
2772
+ });
2773
+ }
2774
+ set src(e) { this.setProperty('src', e); }
2775
+ get src() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.src) || ''; }
2776
+ set startTime(e) { this.__startTime = e; }
2777
+ get startTime() { return this.__startTime || 0; }
2778
+ set title(e) { this.dataset('title', e); }
2779
+ get title() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.dataset.title) || ''; }
2780
+ set epname(e) { this.dataset('epname', e); }
2781
+ get epname() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.dataset.epname) || ''; }
2782
+ set singer(e) { this.dataset('singer', e); }
2783
+ get singer() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.dataset.singer) || ''; }
2784
+ set coverImgUrl(e) { this.dataset('coverImgUrl', e); }
2785
+ get coverImgUrl() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.dataset.coverImgUrl) || ''; }
2786
+ set webUrl(e) { this.dataset('webUrl', e); }
2787
+ get webUrl() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.dataset.webUrl) || ''; }
2788
+ set protocol(e) { this.dataset('protocol', e); }
2789
+ get protocol() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.dataset.protocol) || ''; }
2790
+ set playbackRate(e) { this.setProperty('playbackRate', e); }
2791
+ get playbackRate() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.playbackRate) || 0; }
2792
+ get duration() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.duration) || 0; }
2793
+ get currentTime() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.currentTime) || 0; }
2794
+ get paused() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.paused) || false; }
2795
+ get buffered() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.buffered.length) || 0; }
2796
+ set referrerPolicy(e) { var _a; (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.setAttribute('referrerpolicy', e); }
2797
+ get referrerPolicy() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.getAttribute('referrerpolicy')) || 'origin'; }
2798
+ setProperty(key, value) {
2799
+ if (this.Instance) {
2800
+ this.Instance[key] = value;
2801
+ }
2802
+ }
2803
+ dataset(key, value) {
2804
+ if (this.Instance) {
2805
+ this.Instance.dataset[key] = value;
2806
+ }
2807
+ }
2808
+ }
2809
+
2687
2810
  // 背景音频
2688
2811
  const stopBackgroundAudio = temporarilyNotSupport('stopBackgroundAudio');
2689
2812
  const seekBackgroundAudio = temporarilyNotSupport('seekBackgroundAudio');
@@ -2693,29 +2816,14 @@ const onBackgroundAudioStop = temporarilyNotSupport('onBackgroundAudioStop');
2693
2816
  const onBackgroundAudioPlay = temporarilyNotSupport('onBackgroundAudioPlay');
2694
2817
  const onBackgroundAudioPause = temporarilyNotSupport('onBackgroundAudioPause');
2695
2818
  const getBackgroundAudioPlayerState = temporarilyNotSupport('getBackgroundAudioPlayerState');
2696
- const getBackgroundAudioManager = temporarilyNotSupport('getBackgroundAudioManager');
2819
+ /**
2820
+ * 获取全局唯一的背景音频管理器
2821
+ */
2822
+ const getBackgroundAudioManager = () => new BackgroundAudioManager();
2697
2823
 
2698
2824
  // 相机
2699
2825
  const createCameraContext = temporarilyNotSupport('createCameraContext');
2700
2826
 
2701
- // 富文本
2702
- class EditorContext {
2703
- constructor() {
2704
- this.blur = temporarilyNotSupport('EditorContext.blur');
2705
- this.clear = temporarilyNotSupport('EditorContext.clear');
2706
- this.format = temporarilyNotSupport('EditorContext.format');
2707
- this.getContents = temporarilyNotSupport('EditorContext.getContents');
2708
- this.insertDivider = temporarilyNotSupport('EditorContext.insertDivider');
2709
- this.insertImage = temporarilyNotSupport('EditorContext.insertImage');
2710
- this.insertText = temporarilyNotSupport('EditorContext.insertText');
2711
- this.redo = temporarilyNotSupport('EditorContext.redo');
2712
- this.removeFormat = temporarilyNotSupport('EditorContext.removeFormat');
2713
- this.scrollIntoView = temporarilyNotSupport('EditorContext.scrollIntoView');
2714
- this.setContents = temporarilyNotSupport('EditorContext.setContents');
2715
- this.undo = temporarilyNotSupport('EditorContext.undo');
2716
- }
2717
- }
2718
-
2719
2827
  /**
2720
2828
  * previewImage api基于开源的React组件[react-wx-images-viewer](https://github.com/react-ld/react-wx-images-viewer)开发,感谢!
2721
2829
  */
@@ -6134,7 +6242,7 @@ const createTCPSocket = temporarilyNotSupport('createTCPSocket');
6134
6242
  // UDP 通信
6135
6243
  const createUDPSocket = temporarilyNotSupport('createUDPSocket');
6136
6244
 
6137
- const createUploadTask = ({ url, filePath, formData, name, header, timeout, fileName, success, error }) => {
6245
+ const createUploadTask = ({ url, filePath, formData = {}, name, header, timeout, fileName, success, error }) => {
6138
6246
  let timeoutInter;
6139
6247
  let formKey;
6140
6248
  const apiName = 'uploadFile';
@@ -6513,12 +6621,16 @@ const authPrivateMessage = temporarilyNotSupport('authPrivateMessage');
6513
6621
  */
6514
6622
  class StyleSheet {
6515
6623
  constructor() {
6624
+ this.$style = null;
6625
+ this.sheet = null;
6516
6626
  this.appendStyleSheet = () => {
6517
- var _a, _b, _c;
6518
- (_a = this.$style) === null || _a === void 0 ? void 0 : _a.setAttribute('type', 'text/css');
6519
- (_b = this.$style) === null || _b === void 0 ? void 0 : _b.setAttribute('data-type', 'Taro');
6520
- document.getElementsByTagName('head')[0].appendChild(this.$style);
6521
- this.sheet = (_c = this.$style) === null || _c === void 0 ? void 0 : _c.sheet;
6627
+ if (this.$style) {
6628
+ const head = document.getElementsByTagName('head')[0];
6629
+ this.$style.setAttribute('type', 'text/css');
6630
+ this.$style.setAttribute('data-type', 'Taro');
6631
+ head.appendChild(this.$style);
6632
+ this.sheet = this.$style.sheet;
6633
+ }
6522
6634
  if (this.sheet && !('insertRule' in this.sheet)) {
6523
6635
  console.warn('当前浏览器不支持 stylesheet.insertRule 接口');
6524
6636
  }
@@ -6880,16 +6992,16 @@ const pageScrollTo = ({ scrollTop, selector = '', duration = 300, success, fail,
6880
6992
  let scrollFunc;
6881
6993
  const handle = new MethodHandler({ name: 'pageScrollTo', success, fail, complete });
6882
6994
  return new Promise((resolve, reject) => {
6883
- var _a;
6995
+ var _a, _b;
6884
6996
  try {
6885
6997
  if (scrollTop === undefined && !selector) {
6886
6998
  return handle.fail({
6887
6999
  errMsg: 'scrollTop" 或 "selector" 需要其之一'
6888
7000
  }, reject);
6889
7001
  }
6890
- const id = (_a = runtime.Current.page) === null || _a === void 0 ? void 0 : _a.path;
7002
+ const id = (_b = (_a = runtime.Current.page) === null || _a === void 0 ? void 0 : _a.path) === null || _b === void 0 ? void 0 : _b.replace(/([^a-z0-9\u00a0-\uffff_-])/ig, '\\$1');
6891
7003
  const el = (id
6892
- ? document.getElementById(id)
7004
+ ? document.querySelector(`.taro_page#${id}`)
6893
7005
  : document.querySelector('.taro_page') ||
6894
7006
  document.querySelector('.taro_router'));
6895
7007
  if (!scrollFunc) {
@@ -8489,7 +8601,6 @@ Object.defineProperty(exports, 'switchTab', {
8489
8601
  exports.Behavior = Behavior;
8490
8602
  exports.Current = Current;
8491
8603
  exports.ENV_TYPE = ENV_TYPE;
8492
- exports.EditorContext = EditorContext;
8493
8604
  exports.Events = Events;
8494
8605
  exports.Link = Link;
8495
8606
  exports.addCard = addCard;
package/dist/taroApis.js CHANGED
@@ -1 +1 @@
1
- module.exports = new Set(["EditorContext","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"])
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.0",
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",
@@ -17,7 +17,7 @@
17
17
  "test:dev": "jest --watch",
18
18
  "test:coverage": "jest --coverage",
19
19
  "copy:assets": "copy src/**/*.css dist",
20
- "build": "tsc & rollup -c & npm run copy:assets",
20
+ "build": "rollup -c && npm run copy:assets && tsc",
21
21
  "dev": "tsc -w & npm run copy:assets"
22
22
  },
23
23
  "repository": {
@@ -30,14 +30,14 @@
30
30
  "author": "O2Team",
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
- "@tarojs/api": "3.4.0",
34
- "@tarojs/router": "3.4.0",
35
- "@tarojs/runtime": "3.4.0",
36
- "@tarojs/taro": "3.4.0",
33
+ "@tarojs/api": "3.4.1",
34
+ "@tarojs/router": "3.4.1",
35
+ "@tarojs/runtime": "3.4.1",
36
+ "@tarojs/taro": "3.4.1",
37
37
  "base64-js": "^1.3.0",
38
38
  "jsonp-retry": "^1.0.3",
39
39
  "mobile-detect": "^1.4.2",
40
40
  "whatwg-fetch": "^3.4.0"
41
41
  },
42
- "gitHead": "a0e97bc937f878cc059f54748c9a3829fa3f4664"
42
+ "gitHead": "a2437215b1966fd0b6dd09311bcb4fd894a871d0"
43
43
  }
@@ -218,7 +218,7 @@ export class CanvasContext implements Taro.CanvasContext {
218
218
  translate (...args) { return this.enqueueActions(this.ctx.translate, ...args) }
219
219
 
220
220
  measureText (text: string): TextMetrics {
221
- return this.measureText(text)
221
+ return this.ctx.measureText(text)
222
222
  }
223
223
 
224
224
  createCircularGradient (x: number, y: number, r: number): CanvasGradient {
@@ -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
  }
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 { CallbackManager } from '../../utils/handler'
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('canplay', callback)
71
- onPlay = (callback = () => {}) => this.Instance?.addEventListener('play', callback)
72
- onPause = (callback = () => {}) => this.Instance?.addEventListener('pause', callback)
73
- onStop = (callback = () => {}) => this.stopStack.add(callback)
74
- onEnded = (callback = () => {}) => this.Instance?.addEventListener('ended', callback)
75
- onTimeUpdate = (callback = () => {}) => this.Instance?.addEventListener('timeupdate', callback)
76
- onError = (callback?: ((res: Taro.InnerAudioContext.onErrorDetail) => void)) => this.errorStack.add(callback)
77
- onWaiting = (callback = () => {}) => this.Instance?.addEventListener('waiting', callback)
78
- onSeeking = (callback = () => {}) => this.Instance?.addEventListener('seeking', callback)
79
- onSeeked = (callback = () => {}) => this.Instance?.addEventListener('seeked', callback)
80
- offCanplay = (callback = () => {}) => this.Instance?.removeEventListener('canplay', callback)
81
- offPlay = (callback = () => {}) => this.Instance?.removeEventListener('play', callback)
82
- offPause = (callback = () => {}) => this.Instance?.removeEventListener('pause', callback)
83
- offStop = (callback = () => {}) => this.stopStack.remove(callback)
84
- offEnded = (callback = () => {}) => this.Instance?.removeEventListener('ended', callback)
85
- offTimeUpdate = (callback = () => {}) => this.Instance?.removeEventListener('timeupdate', callback)
86
- offError = (callback = () => {}) => this.errorStack.remove(callback)
87
- offWaiting = (callback = () => {}) => this.Instance?.removeEventListener('waiting', callback)
88
- offSeeking = (callback = () => {}) => this.Instance?.removeEventListener('seeking', callback)
89
- offSeeked = (callback = () => {}) => this.Instance?.removeEventListener('seeked', callback)
90
- }
91
6
 
92
7
  export const stopVoice = temporarilyNotSupport('stopVoice')
93
8
  export const setInnerAudioOption = temporarilyNotSupport('setInnerAudioOption')