@tarojs/taro-h5 3.6.6-alpha.2 → 3.6.6

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.
@@ -0,0 +1,35 @@
1
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
+
3
+ function getDefaultExportFromCjs (x) {
4
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
+ }
6
+
7
+ function getDefaultExportFromNamespaceIfPresent (n) {
8
+ return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;
9
+ }
10
+
11
+ function getDefaultExportFromNamespaceIfNotNamed (n) {
12
+ return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
13
+ }
14
+
15
+ function getAugmentedNamespace(n) {
16
+ if (n.__esModule) return n;
17
+ var a = Object.defineProperty({}, '__esModule', {value: true});
18
+ Object.keys(n).forEach(function (k) {
19
+ var d = Object.getOwnPropertyDescriptor(n, k);
20
+ Object.defineProperty(a, k, d.get ? d : {
21
+ enumerable: true,
22
+ get: function () {
23
+ return n[k];
24
+ }
25
+ });
26
+ });
27
+ return a;
28
+ }
29
+
30
+ function commonjsRequire (path) {
31
+ throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
32
+ }
33
+
34
+ export { commonjsGlobal, commonjsRequire, getAugmentedNamespace, getDefaultExportFromCjs, getDefaultExportFromNamespaceIfNotNamed, getDefaultExportFromNamespaceIfPresent };
35
+ //# sourceMappingURL=_commonjsHelpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_commonjsHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,4 @@
1
+ var lodash = {exports: {}};
2
+
3
+ export { lodash as l };
4
+ //# sourceMappingURL=lodash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lodash.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,18 +1,18 @@
1
1
  import Taro from '@tarojs/api';
2
- declare const onUnhandledRejection: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
3
- declare const onThemeChange: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
4
- declare const onPageNotFound: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
5
- declare const onError: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
2
+ declare const onUnhandledRejection: typeof Taro.onUnhandledRejection;
3
+ declare const onThemeChange: typeof Taro.onThemeChange;
4
+ declare const onPageNotFound: typeof Taro.onPageNotFound;
5
+ declare const onError: typeof Taro.onError;
6
6
  declare const onAudioInterruptionEnd: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
7
7
  declare const onAudioInterruptionBegin: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
8
8
  declare const onAppShow: typeof Taro.onAppShow;
9
9
  declare const onAppHide: typeof Taro.onAppHide;
10
- declare const offUnhandledRejection: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
11
- declare const offThemeChange: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
12
- declare const offPageNotFound: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
13
- declare const offError: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
10
+ declare const offUnhandledRejection: typeof Taro.offUnhandledRejection;
11
+ declare const offThemeChange: typeof Taro.offThemeChange;
12
+ declare const offPageNotFound: typeof Taro.offPageNotFound;
13
+ declare const offError: typeof Taro.offError;
14
14
  declare const offAudioInterruptionEnd: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
15
15
  declare const offAudioInterruptionBegin: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
16
- declare const offAppShow: typeof Taro.offWindowResize;
17
- declare const offAppHide: typeof Taro.offWindowResize;
16
+ declare const offAppShow: typeof Taro.offAppShow;
17
+ declare const offAppHide: typeof Taro.offAppHide;
18
18
  export { onUnhandledRejection, onThemeChange, onPageNotFound, onError, onAudioInterruptionEnd, onAudioInterruptionBegin, onAppShow, onAppHide, offUnhandledRejection, offThemeChange, offPageNotFound, offError, offAudioInterruptionEnd, offAudioInterruptionBegin, offAppShow, offAppHide };
@@ -1,16 +1,38 @@
1
1
  import Taro from '@tarojs/api';
2
+ import '../../../node_modules/.pnpm/registry.npmjs.org_lodash@4.17.21/node_modules/lodash/lodash.js';
2
3
  import { parse } from 'query-string';
3
4
  import { temporarilyNotSupport } from '../../../utils/index.js';
4
5
  import { CallbackManager } from '../../../utils/handler.js';
6
+ import { l as lodash } from '../../../_virtual/lodash.js';
5
7
 
8
+ const unhandledRejectionCallbackManager = new CallbackManager();
9
+ const themeChangeCallbackManager = new CallbackManager();
10
+ const pageNotFoundCallbackManager = new CallbackManager();
11
+ const errorCallbackManager = new CallbackManager();
6
12
  const appShowCallbackManager = new CallbackManager();
7
13
  const appHideCallbackManager = new CallbackManager();
14
+ const unhandledRejectionListener = (res) => {
15
+ unhandledRejectionCallbackManager.trigger(res);
16
+ };
17
+ let themeMatchMedia = null;
18
+ const themeChangeListener = (res) => {
19
+ themeChangeCallbackManager.trigger({
20
+ theme: res.matches ? 'dark' : 'light'
21
+ });
22
+ };
23
+ const pageNotFoundListener = (res) => {
24
+ pageNotFoundCallbackManager.trigger(res);
25
+ };
26
+ const errorListener = (res) => {
27
+ // @ts-ignore
28
+ errorCallbackManager.trigger(res.stack || res.message || res);
29
+ };
8
30
  const getApp = () => {
9
31
  var _a;
10
32
  const path = (_a = Taro.Current.page) === null || _a === void 0 ? void 0 : _a.path;
11
33
  return {
12
34
  /** 小程序切前台的路径 */
13
- path: path === null || path === void 0 ? void 0 : path.substring(0, path.indexOf('?')),
35
+ path: (path === null || path === void 0 ? void 0 : path.substring(0, path.indexOf('?'))) || '',
14
36
  /** 小程序切前台的 query 参数 */
15
37
  query: parse(location.search),
16
38
  /** 来源信息。 */
@@ -32,10 +54,33 @@ const appHideListener = () => {
32
54
  }
33
55
  };
34
56
  // 应用级事件
35
- const onUnhandledRejection = temporarilyNotSupport('onUnhandledRejection');
36
- const onThemeChange = temporarilyNotSupport('onThemeChange');
37
- const onPageNotFound = temporarilyNotSupport('onPageNotFound');
38
- const onError = temporarilyNotSupport('onError');
57
+ const onUnhandledRejection = callback => {
58
+ unhandledRejectionCallbackManager.add(callback);
59
+ if (unhandledRejectionCallbackManager.count() === 1) {
60
+ window.addEventListener('unhandledrejection', unhandledRejectionListener);
61
+ }
62
+ };
63
+ const onThemeChange = callback => {
64
+ themeChangeCallbackManager.add(callback);
65
+ if (themeChangeCallbackManager.count() === 1) {
66
+ if (lodash.exports.isNil(themeMatchMedia)) {
67
+ themeMatchMedia = window.matchMedia('(prefers-color-scheme: light)');
68
+ }
69
+ themeMatchMedia.addEventListener('change', themeChangeListener);
70
+ }
71
+ };
72
+ const onPageNotFound = callback => {
73
+ pageNotFoundCallbackManager.add(callback);
74
+ if (pageNotFoundCallbackManager.count() === 1) {
75
+ Taro.eventCenter.on('__taroRouterNotFound', pageNotFoundListener);
76
+ }
77
+ };
78
+ const onError = callback => {
79
+ errorCallbackManager.add(callback);
80
+ if (errorCallbackManager.count() === 1) {
81
+ window.addEventListener('error', errorListener);
82
+ }
83
+ };
39
84
  const onAudioInterruptionEnd = temporarilyNotSupport('onAudioInterruptionEnd');
40
85
  const onAudioInterruptionBegin = temporarilyNotSupport('onAudioInterruptionBegin');
41
86
  const onAppShow = callback => {
@@ -50,10 +95,34 @@ const onAppHide = callback => {
50
95
  window.addEventListener('visibilitychange', appHideListener);
51
96
  }
52
97
  };
53
- const offUnhandledRejection = temporarilyNotSupport('offUnhandledRejection');
54
- const offThemeChange = temporarilyNotSupport('offThemeChange');
55
- const offPageNotFound = temporarilyNotSupport('offPageNotFound');
56
- const offError = temporarilyNotSupport('offError');
98
+ const offUnhandledRejection = callback => {
99
+ unhandledRejectionCallbackManager.remove(callback);
100
+ if (unhandledRejectionCallbackManager.count() === 0) {
101
+ window.removeEventListener('unhandledrejection', unhandledRejectionListener);
102
+ }
103
+ };
104
+ const offThemeChange = callback => {
105
+ themeChangeCallbackManager.remove(callback);
106
+ if (themeChangeCallbackManager.count() === 0) {
107
+ if (lodash.exports.isNil(themeMatchMedia)) {
108
+ themeMatchMedia = window.matchMedia('(prefers-color-scheme: light)');
109
+ }
110
+ themeMatchMedia.removeEventListener('change', themeChangeListener);
111
+ themeMatchMedia = null;
112
+ }
113
+ };
114
+ const offPageNotFound = callback => {
115
+ pageNotFoundCallbackManager.remove(callback);
116
+ if (pageNotFoundCallbackManager.count() === 0) {
117
+ Taro.eventCenter.off('__taroRouterNotFound', pageNotFoundListener);
118
+ }
119
+ };
120
+ const offError = callback => {
121
+ errorCallbackManager.remove(callback);
122
+ if (errorCallbackManager.count() === 0) {
123
+ window.removeEventListener('error', errorListener);
124
+ }
125
+ };
57
126
  const offAudioInterruptionEnd = temporarilyNotSupport('offAudioInterruptionEnd');
58
127
  const offAudioInterruptionBegin = temporarilyNotSupport('offAudioInterruptionBegin');
59
128
  const offAppShow = callback => {
@@ -1 +1 @@
1
- {"version":3,"file":"app-event.js","sources":["../../../../src/api/base/weapp/app-event.ts"],"sourcesContent":["import Taro from '@tarojs/api'\nimport { parse } from 'query-string'\n\nimport { temporarilyNotSupport } from '../../../utils'\nimport { CallbackManager } from '../../../utils/handler'\n\nconst appShowCallbackManager = new CallbackManager()\nconst appHideCallbackManager = new CallbackManager()\n\nconst getApp = () => {\n const path = Taro.Current.page?.path\n return {\n /** 小程序切前台的路径 */\n path: path?.substring(0, path.indexOf('?')),\n /** 小程序切前台的 query 参数 */\n query: parse(location.search),\n /** 来源信息。 */\n referrerInfo: {},\n /** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */\n scene: 0,\n /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */\n shareTicket: ''\n }\n}\n\nconst appShowListener = () => {\n if (document.visibilityState !== 'hidden') {\n appShowCallbackManager.trigger(getApp())\n }\n}\n\nconst appHideListener = () => {\n if (document.visibilityState === 'hidden') {\n appHideCallbackManager.trigger(getApp())\n }\n}\n\n// 应用级事件\nexport const onUnhandledRejection = temporarilyNotSupport('onUnhandledRejection')\nexport const onThemeChange = temporarilyNotSupport('onThemeChange')\nexport const onPageNotFound = temporarilyNotSupport('onPageNotFound')\nexport const onError = temporarilyNotSupport('onError')\nexport const onAudioInterruptionEnd = temporarilyNotSupport('onAudioInterruptionEnd')\nexport const onAudioInterruptionBegin = temporarilyNotSupport('onAudioInterruptionBegin')\n\nexport const onAppShow: typeof Taro.onAppShow = callback => {\n appShowCallbackManager.add(callback)\n if (appShowCallbackManager.count() === 1) {\n window.addEventListener('visibilitychange', appShowListener)\n }\n}\n\nexport const onAppHide: typeof Taro.onAppHide = callback => {\n appHideCallbackManager.add(callback)\n if (appHideCallbackManager.count() === 1) {\n window.addEventListener('visibilitychange', appHideListener)\n }\n}\n\nexport const offUnhandledRejection = temporarilyNotSupport('offUnhandledRejection')\nexport const offThemeChange = temporarilyNotSupport('offThemeChange')\nexport const offPageNotFound = temporarilyNotSupport('offPageNotFound')\nexport const offError = temporarilyNotSupport('offError')\nexport const offAudioInterruptionEnd = temporarilyNotSupport('offAudioInterruptionEnd')\nexport const offAudioInterruptionBegin = temporarilyNotSupport('offAudioInterruptionBegin')\n\nexport const offAppShow: typeof Taro.offWindowResize = callback => {\n appShowCallbackManager.remove(callback)\n if (appShowCallbackManager.count() === 0) {\n window.removeEventListener('visibilitychange', appShowListener)\n }\n}\n\nexport const offAppHide: typeof Taro.offWindowResize = callback => {\n appHideCallbackManager.remove(callback)\n if (appHideCallbackManager.count() === 0) {\n window.removeEventListener('visibilitychange', appHideListener)\n }\n}\n"],"names":[],"mappings":";;;;;AAMA,MAAM,sBAAsB,GAAG,IAAI,eAAe,EAAE,CAAA;AACpD,MAAM,sBAAsB,GAAG,IAAI,eAAe,EAAE,CAAA;AAEpD,MAAM,MAAM,GAAG,MAAK;;IAClB,MAAM,IAAI,GAAG,CAAA,EAAA,GAAA,IAAI,CAAC,OAAO,CAAC,IAAI,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAI,CAAA;IACpC,OAAO;;AAEL,QAAA,IAAI,EAAE,IAAI,KAAA,IAAA,IAAJ,IAAI,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAJ,IAAI,CAAE,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;;AAE3C,QAAA,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;;AAE7B,QAAA,YAAY,EAAE,EAAE;;AAEhB,QAAA,KAAK,EAAE,CAAC;;AAER,QAAA,WAAW,EAAE,EAAE;KAChB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,eAAe,GAAG,MAAK;AAC3B,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qBAAqB,CAAC,iBAAiB,EAAC;MAC1D,QAAQ,GAAG,qBAAqB,CAAC,UAAU,EAAC;MAC5C,uBAAuB,GAAG,qBAAqB,CAAC,yBAAyB,EAAC;MAC1E,yBAAyB,GAAG,qBAAqB,CAAC,2BAA2B,EAAC;AAE9E,MAAA,UAAU,GAAgC,QAAQ,IAAG;AAChE,IAAA,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AACvC,IAAA,IAAI,sBAAsB,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;AACxC,QAAA,MAAM,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAA;AAChE,KAAA;AACH,EAAC;AAEY,MAAA,UAAU,GAAgC,QAAQ,IAAG;AAChE,IAAA,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AACvC,IAAA,IAAI,sBAAsB,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;AACxC,QAAA,MAAM,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAA;AAChE,KAAA;AACH;;;;"}
1
+ {"version":3,"file":"app-event.js","sources":["../../../../src/api/base/weapp/app-event.ts"],"sourcesContent":["import Taro from '@tarojs/api'\nimport { isNil } from 'lodash'\nimport { parse } from 'query-string'\n\nimport { temporarilyNotSupport } from '../../../utils'\nimport { CallbackManager } from '../../../utils/handler'\n\nconst unhandledRejectionCallbackManager = new CallbackManager<[Taro.onUnhandledRejection.Result]>()\nconst themeChangeCallbackManager = new CallbackManager<[Taro.onThemeChange.Result]>()\nconst pageNotFoundCallbackManager = new CallbackManager<[Taro.onPageNotFound.Result]>()\nconst errorCallbackManager = new CallbackManager<Parameters<Taro.onError.Callback>>()\nconst appShowCallbackManager = new CallbackManager<[Taro.onAppShow.CallbackResult]>()\nconst appHideCallbackManager = new CallbackManager<[Taro.onAppShow.CallbackResult]>()\n\nconst unhandledRejectionListener = (res: PromiseRejectionEvent) => {\n unhandledRejectionCallbackManager.trigger(res)\n}\n\nlet themeMatchMedia: MediaQueryList | null = null\nconst themeChangeListener = (res: MediaQueryListEvent) => {\n themeChangeCallbackManager.trigger({\n theme: res.matches ? 'dark' : 'light'\n })\n}\n\nconst pageNotFoundListener = (res: Taro.onPageNotFound.Result) => {\n pageNotFoundCallbackManager.trigger(res)\n}\n\nconst errorListener = (res: ErrorEvent) => {\n // @ts-ignore\n errorCallbackManager.trigger(res.stack || res.message || res)\n}\n\nconst getApp = () => {\n const path = Taro.Current.page?.path\n return {\n /** 小程序切前台的路径 */\n path: path?.substring(0, path.indexOf('?')) || '',\n /** 小程序切前台的 query 参数 */\n query: parse(location.search),\n /** 来源信息。 */\n referrerInfo: {},\n /** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */\n scene: 0,\n /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */\n shareTicket: ''\n }\n}\n\nconst appShowListener = () => {\n if (document.visibilityState !== 'hidden') {\n appShowCallbackManager.trigger(getApp())\n }\n}\n\nconst appHideListener = () => {\n if (document.visibilityState === 'hidden') {\n appHideCallbackManager.trigger(getApp())\n }\n}\n\n// 应用级事件\nexport const onUnhandledRejection: typeof Taro.onUnhandledRejection = callback => {\n unhandledRejectionCallbackManager.add(callback)\n if (unhandledRejectionCallbackManager.count() === 1) {\n window.addEventListener('unhandledrejection', unhandledRejectionListener)\n }\n}\n\nexport const onThemeChange: typeof Taro.onThemeChange = callback => {\n themeChangeCallbackManager.add(callback)\n if (themeChangeCallbackManager.count() === 1) {\n if (isNil(themeMatchMedia)) {\n themeMatchMedia = window.matchMedia('(prefers-color-scheme: light)')\n }\n themeMatchMedia.addEventListener('change', themeChangeListener)\n }\n}\n\nexport const onPageNotFound: typeof Taro.onPageNotFound = callback => {\n pageNotFoundCallbackManager.add(callback)\n if (pageNotFoundCallbackManager.count() === 1) {\n Taro.eventCenter.on('__taroRouterNotFound', pageNotFoundListener)\n }\n}\n\nexport const onError: typeof Taro.onError = callback => {\n errorCallbackManager.add(callback)\n if (errorCallbackManager.count() === 1) {\n window.addEventListener('error', errorListener)\n }\n}\n\nexport const onAudioInterruptionEnd = temporarilyNotSupport('onAudioInterruptionEnd')\nexport const onAudioInterruptionBegin = temporarilyNotSupport('onAudioInterruptionBegin')\n\nexport const onAppShow: typeof Taro.onAppShow = callback => {\n appShowCallbackManager.add(callback)\n if (appShowCallbackManager.count() === 1) {\n window.addEventListener('visibilitychange', appShowListener)\n }\n}\n\nexport const onAppHide: typeof Taro.onAppHide = callback => {\n appHideCallbackManager.add(callback)\n if (appHideCallbackManager.count() === 1) {\n window.addEventListener('visibilitychange', appHideListener)\n }\n}\n\nexport const offUnhandledRejection: typeof Taro.offUnhandledRejection = callback => {\n unhandledRejectionCallbackManager.remove(callback)\n if (unhandledRejectionCallbackManager.count() === 0) {\n window.removeEventListener('unhandledrejection', unhandledRejectionListener)\n }\n}\n\nexport const offThemeChange: typeof Taro.offThemeChange = callback => {\n themeChangeCallbackManager.remove(callback)\n if (themeChangeCallbackManager.count() === 0) {\n if (isNil(themeMatchMedia)) {\n themeMatchMedia = window.matchMedia('(prefers-color-scheme: light)')\n }\n themeMatchMedia.removeEventListener('change', themeChangeListener)\n themeMatchMedia = null\n }\n}\n\nexport const offPageNotFound: typeof Taro.offPageNotFound = callback => {\n pageNotFoundCallbackManager.remove(callback)\n if (pageNotFoundCallbackManager.count() === 0) {\n Taro.eventCenter.off('__taroRouterNotFound', pageNotFoundListener)\n }\n}\n\nexport const offError: typeof Taro.offError = callback => {\n errorCallbackManager.remove(callback)\n if (errorCallbackManager.count() === 0) {\n window.removeEventListener('error', errorListener)\n }\n}\n\nexport const offAudioInterruptionEnd = temporarilyNotSupport('offAudioInterruptionEnd')\nexport const offAudioInterruptionBegin = temporarilyNotSupport('offAudioInterruptionBegin')\n\nexport const offAppShow: typeof Taro.offAppShow = callback => {\n appShowCallbackManager.remove(callback)\n if (appShowCallbackManager.count() === 0) {\n window.removeEventListener('visibilitychange', appShowListener)\n }\n}\n\nexport const offAppHide: typeof Taro.offAppHide = callback => {\n appHideCallbackManager.remove(callback)\n if (appHideCallbackManager.count() === 0) {\n window.removeEventListener('visibilitychange', appHideListener)\n }\n}\n"],"names":["isNil"],"mappings":";;;;;;;AAOA,MAAM,iCAAiC,GAAG,IAAI,eAAe,EAAsC,CAAA;AACnG,MAAM,0BAA0B,GAAG,IAAI,eAAe,EAA+B,CAAA;AACrF,MAAM,2BAA2B,GAAG,IAAI,eAAe,EAAgC,CAAA;AACvF,MAAM,oBAAoB,GAAG,IAAI,eAAe,EAAqC,CAAA;AACrF,MAAM,sBAAsB,GAAG,IAAI,eAAe,EAAmC,CAAA;AACrF,MAAM,sBAAsB,GAAG,IAAI,eAAe,EAAmC,CAAA;AAErF,MAAM,0BAA0B,GAAG,CAAC,GAA0B,KAAI;AAChE,IAAA,iCAAiC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;AAChD,CAAC,CAAA;AAED,IAAI,eAAe,GAA0B,IAAI,CAAA;AACjD,MAAM,mBAAmB,GAAG,CAAC,GAAwB,KAAI;IACvD,0BAA0B,CAAC,OAAO,CAAC;QACjC,KAAK,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,GAAG,OAAO;AACtC,KAAA,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,oBAAoB,GAAG,CAAC,GAA+B,KAAI;AAC/D,IAAA,2BAA2B,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;AAC1C,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,GAAe,KAAI;;AAExC,IAAA,oBAAoB,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,CAAA;AAC/D,CAAC,CAAA;AAED,MAAM,MAAM,GAAG,MAAK;;IAClB,MAAM,IAAI,GAAG,CAAA,EAAA,GAAA,IAAI,CAAC,OAAO,CAAC,IAAI,MA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AE;AACtC,QAAA,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;AACnD,KAAA;AACH,EAAC;MAEY,uBAAuB,GAAG,qBAAqB,CAAC,yBAAyB,EAAC;MAC1E,yBAAyB,GAAG,qBAAqB,CAAC,2BAA2B,EAAC;AAE9E,MAAA,UAAU,GAA2B,QAAQ,IAAG;AAC3D,IAAA,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AACvC,IAAA,IAAI,sBAAsB,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;AACxC,QAAA,MAAM,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAA;AAChE,KAAA;AACH,EAAC;AAEY,MAAA,UAAU,GAA2B,QAAQ,IAAG;AAC3D,IAAA,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AACvC,IAAA,IAAI,sBAAsB,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;AACxC,QAAA,MAAM,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAA;AAChE,KAAA;AACH;;;;"}
@@ -72,22 +72,22 @@ declare const getSystemInfo: typeof Taro.getSystemInfo;
72
72
  declare const updateWeChatApp: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
73
73
  declare const getUpdateManager: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
74
74
  // 应用级事件
75
- declare const onUnhandledRejection: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
76
- declare const onThemeChange: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
77
- declare const onPageNotFound: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
78
- declare const onError: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
75
+ declare const onUnhandledRejection: typeof Taro.onUnhandledRejection;
76
+ declare const onThemeChange: typeof Taro.onThemeChange;
77
+ declare const onPageNotFound: typeof Taro.onPageNotFound;
78
+ declare const onError: typeof Taro.onError;
79
79
  declare const onAudioInterruptionEnd: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
80
80
  declare const onAudioInterruptionBegin: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
81
81
  declare const onAppShow: typeof Taro.onAppShow;
82
82
  declare const onAppHide: typeof Taro.onAppHide;
83
- declare const offUnhandledRejection: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
84
- declare const offThemeChange: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
85
- declare const offPageNotFound: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
86
- declare const offError: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
83
+ declare const offUnhandledRejection: typeof Taro.offUnhandledRejection;
84
+ declare const offThemeChange: typeof Taro.offThemeChange;
85
+ declare const offPageNotFound: typeof Taro.offPageNotFound;
86
+ declare const offError: typeof Taro.offError;
87
87
  declare const offAudioInterruptionEnd: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
88
88
  declare const offAudioInterruptionBegin: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
89
- declare const offAppShow: typeof Taro.offWindowResize;
90
- declare const offAppHide: typeof Taro.offWindowResize;
89
+ declare const offAppShow: typeof Taro.offAppShow;
90
+ declare const offAppHide: typeof Taro.offAppHide;
91
91
  // 生命周期
92
92
  declare const getLaunchOptionsSync: typeof Taro.getLaunchOptionsSync;
93
93
  declare const getEnterOptionsSync: typeof Taro.getEnterOptionsSync;
@@ -360,36 +360,23 @@ declare const createMediaAudioPlayer: (option?: {}, ...args: any[]) => Promise<P
360
360
  */
361
361
  declare const createInnerAudioContext: typeof Taro.createInnerAudioContext;
362
362
  declare const createAudioContext: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
363
- type TCallbackManagerParam = (...arr: unknown[]) => void;
364
- interface ICallbackManagerOption {
365
- callback?: TCallbackManagerParam;
363
+ type TCallbackManagerFunc<T extends unknown[] = unknown[]> = (...arr: T) => void;
364
+ interface ICallbackManagerOption<T extends unknown[] = unknown[]> {
365
+ callback?: TCallbackManagerFunc<T>;
366
366
  ctx?: any;
367
367
  [key: string]: unknown;
368
368
  }
369
- type TCallbackManagerListItem = (TCallbackManagerParam | ICallbackManagerOption);
370
- type TCallbackManagerList = TCallbackManagerListItem[];
371
- declare class CallbackManager {
372
- callbacks: TCallbackManagerList;
373
- /**
374
- * 添加回调
375
- * @param {{ callback: function, ctx: any } | function} opt
376
- */
377
- add: (opt?: TCallbackManagerListItem) => void;
378
- /**
379
- * 移除回调
380
- * @param {{ callback: function, ctx: any } | function} opt
381
- */
382
- remove: (opt?: TCallbackManagerListItem) => void;
383
- /**
384
- * 获取回调函数数量
385
- * @return {number}
386
- */
369
+ type TCallbackManagerUnit<T extends unknown[] = unknown[]> = (TCallbackManagerFunc<T> | ICallbackManagerOption<T>);
370
+ declare class CallbackManager<T extends unknown[] = unknown[]> {
371
+ callbacks: TCallbackManagerUnit<T>[];
372
+ /** 添加回调 */
373
+ add: (opt?: TCallbackManagerUnit<T>) => void;
374
+ /** 移除回调 */
375
+ remove: (opt?: TCallbackManagerUnit<T>) => void;
376
+ /** 获取回调函数数量 */
387
377
  count: () => number;
388
- /**
389
- * 触发回调
390
- * @param {...any} args 回调的调用参数
391
- */
392
- trigger: (...args: TCallbackManagerList) => void;
378
+ /** 触发回调 */
379
+ trigger: (...args: T) => void;
393
380
  }
394
381
  declare class BackgroundAudioManager implements Taro.BackgroundAudioManager {
395
382
  Instance?: HTMLAudioElement;