@tarojs/taro-h5 3.5.0-beta.2 → 3.5.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/base/weapp/app-event.js +55 -4
- package/dist/api/media/audio/InnerAudioContext.js +1 -1
- package/dist/index.cjs.js +53 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +54 -6
- package/dist/index.esm.js.map +1 -1
- package/package.json +5 -5
- package/src/api/base/weapp/app-event.ts +64 -4
- package/src/api/media/audio/InnerAudioContext.ts +1 -1
- package/src/api/network/websocket/socketTask.ts +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ export { getCurrentPages, history, navigateBack, navigateTo, reLaunch, redirectT
|
|
|
4
4
|
import { hooks, Current as Current$1 } from '@tarojs/runtime';
|
|
5
5
|
import { fromByteArray, toByteArray } from 'base64-js';
|
|
6
6
|
import MobileDetect from 'mobile-detect';
|
|
7
|
-
import { stringify } from 'query-string';
|
|
7
|
+
import { parse, stringify } from 'query-string';
|
|
8
8
|
import 'whatwg-fetch';
|
|
9
9
|
import jsonpRetry from 'jsonp-retry';
|
|
10
10
|
|
|
@@ -746,6 +746,34 @@ const getSystemInfo = (options = {}) => __awaiter(void 0, void 0, void 0, functi
|
|
|
746
746
|
const updateWeChatApp = temporarilyNotSupport('updateWeChatApp');
|
|
747
747
|
const getUpdateManager = temporarilyNotSupport('getUpdateManager');
|
|
748
748
|
|
|
749
|
+
const appShowCallbackManager = new CallbackManager();
|
|
750
|
+
const appHideCallbackManager = new CallbackManager();
|
|
751
|
+
const getApp$1 = () => {
|
|
752
|
+
var _a;
|
|
753
|
+
const path = (_a = Taro.Current.page) === null || _a === void 0 ? void 0 : _a.path;
|
|
754
|
+
return {
|
|
755
|
+
/** 小程序切前台的路径 */
|
|
756
|
+
path: path === null || path === void 0 ? void 0 : path.substring(0, path.indexOf('?')),
|
|
757
|
+
/** 小程序切前台的 query 参数 */
|
|
758
|
+
query: parse(location.search),
|
|
759
|
+
/** 来源信息。 */
|
|
760
|
+
referrerInfo: {},
|
|
761
|
+
/** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */
|
|
762
|
+
scene: 0,
|
|
763
|
+
/** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
|
|
764
|
+
shareTicket: ''
|
|
765
|
+
};
|
|
766
|
+
};
|
|
767
|
+
const appShowListener = () => {
|
|
768
|
+
if (document.visibilityState !== 'hidden') {
|
|
769
|
+
appShowCallbackManager.trigger(getApp$1());
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
const appHideListener = () => {
|
|
773
|
+
if (document.visibilityState === 'hidden') {
|
|
774
|
+
appHideCallbackManager.trigger(getApp$1());
|
|
775
|
+
}
|
|
776
|
+
};
|
|
749
777
|
// 应用级事件
|
|
750
778
|
const onUnhandledRejection = temporarilyNotSupport('onUnhandledRejection');
|
|
751
779
|
const onThemeChange = temporarilyNotSupport('onThemeChange');
|
|
@@ -753,16 +781,36 @@ const onPageNotFound = temporarilyNotSupport('onPageNotFound');
|
|
|
753
781
|
const onError = temporarilyNotSupport('onError');
|
|
754
782
|
const onAudioInterruptionEnd = temporarilyNotSupport('onAudioInterruptionEnd');
|
|
755
783
|
const onAudioInterruptionBegin = temporarilyNotSupport('onAudioInterruptionBegin');
|
|
756
|
-
const onAppShow =
|
|
757
|
-
|
|
784
|
+
const onAppShow = callback => {
|
|
785
|
+
appShowCallbackManager.add(callback);
|
|
786
|
+
if (appShowCallbackManager.count() === 1) {
|
|
787
|
+
window.addEventListener('visibilitychange', appShowListener);
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
const onAppHide = callback => {
|
|
791
|
+
appHideCallbackManager.add(callback);
|
|
792
|
+
if (appHideCallbackManager.count() === 1) {
|
|
793
|
+
window.addEventListener('visibilitychange', appHideListener);
|
|
794
|
+
}
|
|
795
|
+
};
|
|
758
796
|
const offUnhandledRejection = temporarilyNotSupport('offUnhandledRejection');
|
|
759
797
|
const offThemeChange = temporarilyNotSupport('offThemeChange');
|
|
760
798
|
const offPageNotFound = temporarilyNotSupport('offPageNotFound');
|
|
761
799
|
const offError = temporarilyNotSupport('offError');
|
|
762
800
|
const offAudioInterruptionEnd = temporarilyNotSupport('offAudioInterruptionEnd');
|
|
763
801
|
const offAudioInterruptionBegin = temporarilyNotSupport('offAudioInterruptionBegin');
|
|
764
|
-
const offAppShow =
|
|
765
|
-
|
|
802
|
+
const offAppShow = callback => {
|
|
803
|
+
appShowCallbackManager.remove(callback);
|
|
804
|
+
if (appShowCallbackManager.count() === 0) {
|
|
805
|
+
window.removeEventListener('visibilitychange', appShowListener);
|
|
806
|
+
}
|
|
807
|
+
};
|
|
808
|
+
const offAppHide = callback => {
|
|
809
|
+
appHideCallbackManager.remove(callback);
|
|
810
|
+
if (appHideCallbackManager.count() === 0) {
|
|
811
|
+
window.removeEventListener('visibilitychange', appHideListener);
|
|
812
|
+
}
|
|
813
|
+
};
|
|
766
814
|
|
|
767
815
|
// 生命周期
|
|
768
816
|
const getLaunchOptionsSync = temporarilyNotSupport('getLaunchOptionsSync');
|
|
@@ -2084,7 +2132,7 @@ class InnerAudioContext {
|
|
|
2084
2132
|
get duration() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.duration) || 0; }
|
|
2085
2133
|
set loop(e) { this.setProperty('loop', e); }
|
|
2086
2134
|
get loop() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.loop) || false; }
|
|
2087
|
-
get paused() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.paused)
|
|
2135
|
+
get paused() { var _a, _b; return (_b = (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.paused) !== null && _b !== void 0 ? _b : true; }
|
|
2088
2136
|
set src(e) { this.setProperty('src', e); }
|
|
2089
2137
|
get src() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.src) || ''; }
|
|
2090
2138
|
set volume(e) { this.setProperty('volume', e); }
|