@tarojs/runtime 4.0.0-beta.8 → 4.0.0-beta.81

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.d.ts CHANGED
@@ -27,6 +27,7 @@ export * from "./emitter/emitter.js";
27
27
  export { hydrate } from "./hydrate.js";
28
28
  export { nextTick } from "./next-tick.js";
29
29
  export { options } from "./options.js";
30
+ export * from "./perf.js";
30
31
  export * from "./utils/index.js";
31
32
  export * from "./instance-4c64b022.js";
32
33
  export * from "./index-26658829.js";
package/dist/index.js CHANGED
@@ -27,8 +27,9 @@ export { eventCenter } from './emitter/emitter.js';
27
27
  export { hydrate } from './hydrate.js';
28
28
  export { nextTick } from './next-tick.js';
29
29
  export { options } from './options.js';
30
+ export { perf } from './perf.js';
30
31
  export { convertNumber2PX, customWrapperCache, extend, getComponentsAlias, incrementId, isComment, isElement, isHasExtractProp, isParentBinded, isText, shortcutAttr } from './utils/index.js';
31
32
  export { handlePolyfill } from './polyfill/index.js';
32
- export { throttle } from './utils/lodash.js';
33
+ export { debounce, throttle } from './utils/lodash.js';
33
34
  export { addLeadingSlash, getCurrentPage, getHomePage, hasBasename, stripBasename, stripSuffix, stripTrailing } from './utils/router.js';
34
35
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -69,6 +69,8 @@ interface PageInstance extends PageLifeCycle {
69
69
  options?: Record<string, unknown>;
70
70
  /** 页面渲染引擎类型 */
71
71
  renderer?: 'webview' | 'skyline';
72
+ /** 获得一个 EventChannel 对象,用于页面间通讯 */
73
+ getOpenerEventChannel?(): Record<string, any>;
72
74
  }
73
75
  interface Show {
74
76
  componentDidShow?(): void;
@@ -85,6 +87,7 @@ interface AppInstance extends Show {
85
87
  onPageNotFound?(res: any): void;
86
88
  onUnhandledRejection?(error: any): void;
87
89
  onShow?(options?: Record<string, unknown>): void;
90
+ onHide?(options?: Record<string, unknown>): void;
88
91
  unmount?(id: string, cb?: () => void): void;
89
92
  taroGlobalData?: Record<any, any>;
90
93
  config?: Record<any, any>;
package/dist/perf.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  declare class Performance {
2
+ #private;
2
3
  private recorder;
3
4
  start(id: string): void;
4
- stop(id: string): void;
5
+ stop(id: string, now?: number): void;
6
+ delayStop(id: string, delay?: number): ((...args: any[]) => void) | undefined;
5
7
  }
6
8
  declare const perf: Performance;
7
9
  export { perf };
package/dist/perf.js CHANGED
@@ -1,7 +1,12 @@
1
+ import { __classPrivateFieldGet } from 'tslib';
1
2
  import { options } from './options.js';
3
+ import './utils/index.js';
4
+ import { debounce } from './utils/lodash.js';
2
5
 
6
+ var _Performance_instances, _Performance_parseTime;
3
7
  class Performance {
4
8
  constructor() {
9
+ _Performance_instances.add(this);
5
10
  this.recorder = new Map();
6
11
  }
7
12
  start(id) {
@@ -10,18 +15,32 @@ class Performance {
10
15
  }
11
16
  this.recorder.set(id, Date.now());
12
17
  }
13
- stop(id) {
18
+ stop(id, now = Date.now()) {
14
19
  if (!options.debug) {
15
20
  return;
16
21
  }
17
- const now = Date.now();
18
22
  const prev = this.recorder.get(id);
23
+ if (!(prev >= 0))
24
+ return;
19
25
  this.recorder.delete(id);
20
26
  const time = now - prev;
21
27
  // eslint-disable-next-line no-console
22
- console.log(`${id} 时长: ${time}ms`);
28
+ console.log(`${id} 时长: ${time}ms 开始时间:${__classPrivateFieldGet(this, _Performance_instances, "m", _Performance_parseTime).call(this, prev)} 结束时间:${__classPrivateFieldGet(this, _Performance_instances, "m", _Performance_parseTime).call(this, now)}`);
29
+ }
30
+ delayStop(id, delay = 500) {
31
+ if (!options.debug) {
32
+ return;
33
+ }
34
+ return debounce((now = Date.now(), cb) => {
35
+ this.stop(id, now);
36
+ cb === null || cb === void 0 ? void 0 : cb();
37
+ }, delay);
23
38
  }
24
39
  }
40
+ _Performance_instances = new WeakSet(), _Performance_parseTime = function _Performance_parseTime(time) {
41
+ const d = new Date(time);
42
+ return `${d.getHours()}:${d.getMinutes()}:${d.getSeconds()}.${`${d.getMilliseconds()}`.padStart(3, '0')}`;
43
+ };
25
44
  const perf = new Performance();
26
45
 
27
46
  export { perf };
package/dist/perf.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"perf.js","sources":["../src/perf.ts"],"sourcesContent":["import { options } from './options'\n\nclass Performance {\n private recorder = new Map<string, number>()\n\n public start (id: string) {\n if (!options.debug) {\n return\n }\n this.recorder.set(id, Date.now())\n }\n\n public stop (id: string) {\n if (!options.debug) {\n return\n }\n const now = Date.now()\n const prev = this.recorder.get(id)!\n this.recorder.delete(id)\n const time = now - prev\n // eslint-disable-next-line no-console\n console.log(`${id} 时长: ${time}ms`)\n }\n}\n\nexport const perf = new Performance()\n"],"names":[],"mappings":";;AAEA,MAAM,WAAW,CAAA;AAAjB,IAAA,WAAA,GAAA;AACU,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAA;KAoB7C;AAlBQ,IAAA,KAAK,CAAE,EAAU,EAAA;AACtB,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;YAClB,OAAM;AACP,SAAA;AACD,QAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;KAClC;AAEM,IAAA,IAAI,CAAE,EAAU,EAAA;AACrB,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;YAClB,OAAM;AACP,SAAA;AACD,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAE,CAAA;AACnC,QAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AACxB,QAAA,MAAM,IAAI,GAAG,GAAG,GAAG,IAAI,CAAA;;QAEvB,OAAO,CAAC,GAAG,CAAC,CAAA,EAAG,EAAE,CAAQ,KAAA,EAAA,IAAI,CAAI,EAAA,CAAA,CAAC,CAAA;KACnC;AACF,CAAA;AAEY,MAAA,IAAI,GAAG,IAAI,WAAW;;;;"}
1
+ {"version":3,"file":"perf.js","sources":["../src/perf.ts"],"sourcesContent":["import { options } from './options'\nimport { debounce } from './utils'\n\nimport type { TFunc } from './interface'\n\nclass Performance {\n private recorder = new Map<string, number>()\n\n public start (id: string) {\n if (!options.debug) {\n return\n }\n this.recorder.set(id, Date.now())\n }\n\n public stop (id: string, now = Date.now()) {\n if (!options.debug) {\n return\n }\n const prev = this.recorder.get(id)!\n if (!(prev >= 0)) return\n\n this.recorder.delete(id)\n const time = now - prev\n // eslint-disable-next-line no-console\n console.log(`${id} 时长: ${time}ms 开始时间:${this.#parseTime(prev)} 结束时间:${this.#parseTime(now)}`)\n }\n\n public delayStop (id: string, delay = 500) {\n if (!options.debug) {\n return\n }\n\n return debounce((now = Date.now(), cb?: TFunc) => {\n this.stop(id, now)\n cb?.()\n }, delay)\n }\n\n #parseTime (time: number) {\n const d = new Date(time)\n return `${d.getHours()}:${d.getMinutes()}:${d.getSeconds()}.${`${d.getMilliseconds()}`.padStart(3, '0')}`\n }\n}\n\nexport const perf = new Performance()\n"],"names":[],"mappings":";;;;;;AAKA,MAAM,WAAW,CAAA;AAAjB,IAAA,WAAA,GAAA;;AACU,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAA;KAqC7C;AAnCQ,IAAA,KAAK,CAAE,EAAU,EAAA;AACtB,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;YAClB,OAAM;AACP,SAAA;AACD,QAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;KAClC;IAEM,IAAI,CAAE,EAAU,EAAE,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,EAAA;AACvC,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;YAClB,OAAM;AACP,SAAA;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAE,CAAA;AACnC,QAAA,IAAI,EAAE,IAAI,IAAI,CAAC,CAAC;YAAE,OAAM;AAExB,QAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AACxB,QAAA,MAAM,IAAI,GAAG,GAAG,GAAG,IAAI,CAAA;;QAEvB,OAAO,CAAC,GAAG,CAAC,CAAG,EAAA,EAAE,CAAQ,KAAA,EAAA,IAAI,CAAW,QAAA,EAAA,sBAAA,CAAA,IAAI,EAAA,sBAAA,EAAA,GAAA,EAAA,sBAAA,CAAW,CAAf,IAAA,CAAA,IAAI,EAAY,IAAI,CAAC,CAAA,MAAA,EAAS,sBAAA,CAAA,IAAI,EAAW,sBAAA,EAAA,GAAA,EAAA,sBAAA,CAAA,CAAA,IAAA,CAAf,IAAI,EAAY,GAAG,CAAC,CAAE,CAAA,CAAC,CAAA;KAC9F;AAEM,IAAA,SAAS,CAAE,EAAU,EAAE,KAAK,GAAG,GAAG,EAAA;AACvC,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;YAClB,OAAM;AACP,SAAA;AAED,QAAA,OAAO,QAAQ,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE,EAAU,KAAI;AAC/C,YAAA,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAA;AAClB,YAAA,EAAE,KAAF,IAAA,IAAA,EAAE,KAAF,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAE,EAAI,CAAA;SACP,EAAE,KAAK,CAAC,CAAA;KACV;AAMF,CAAA;iGAJa,IAAY,EAAA;AACtB,IAAA,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAA;AACxB,IAAA,OAAO,CAAG,EAAA,CAAC,CAAC,QAAQ,EAAE,CAAA,CAAA,EAAI,CAAC,CAAC,UAAU,EAAE,CAAI,CAAA,EAAA,CAAC,CAAC,UAAU,EAAE,CAAI,CAAA,EAAA,CAAA,EAAG,CAAC,CAAC,eAAe,EAAE,CAAE,CAAA,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAA;AAC3G,CAAC,CAAA;AAGU,MAAA,IAAI,GAAG,IAAI,WAAW;;;;"}
@@ -706,6 +706,8 @@ interface PageInstance extends PageLifeCycle {
706
706
  options?: Record<string, unknown>;
707
707
  /** 页面渲染引擎类型 */
708
708
  renderer?: "webview" | "skyline";
709
+ /** 获得一个 EventChannel 对象,用于页面间通讯 */
710
+ getOpenerEventChannel?(): Record<string, any>;
709
711
  }
710
712
  interface Show {
711
713
  componentDidShow?(): void;
@@ -722,6 +724,7 @@ interface AppInstance extends Show {
722
724
  onPageNotFound?(res: any): void;
723
725
  onUnhandledRejection?(error: any): void;
724
726
  onShow?(options?: Record<string, unknown>): void;
727
+ onHide?(options?: Record<string, unknown>): void;
725
728
  unmount?(id: string, cb?: () => void): void;
726
729
  taroGlobalData?: Record<any, any>;
727
730
  config?: Record<any, any>;
@@ -769,6 +772,14 @@ declare function createRecursiveComponentConfig(componentName?: string): any;
769
772
  declare function hydrate(node: TaroElement | TaroText): MiniData;
770
773
  declare const nextTick: (cb: TFunc, ctx?: Record<string, any>) => void;
771
774
  declare const options: Options;
775
+ declare class Performance {
776
+ #private;
777
+ private recorder;
778
+ start(id: string): void;
779
+ stop(id: string, now?: number): void;
780
+ delayStop(id: string, delay?: number): ((...args: any[]) => void) | undefined;
781
+ }
782
+ declare const perf: Performance;
772
783
  declare const incrementId: () => () => string;
773
784
  declare function isElement(node: TaroNode): node is TaroElement;
774
785
  declare function isText(node: TaroNode): node is TaroText;
@@ -789,6 +800,7 @@ declare function extend(ctor: Ctor, methodName: string, options: TFunc | Record<
789
800
  declare function getComponentsAlias(): any;
790
801
  declare function convertNumber2PX(value: number): string;
791
802
  declare function throttle(fn: any, threshold?: number, scope?: any): (...args: any[]) => void;
803
+ declare function debounce(fn: any, ms?: number, scope?: any): (...args: any[]) => void;
792
804
  // export const removeLeadingSlash = (str = '') => str.replace(/^\.?\//, '')
793
805
  // export const removeTrailingSearch = (str = '') => str.replace(/\?[\s\S]*$/, '')
794
806
  declare const addLeadingSlash: (url?: string) => string;
@@ -800,4 +812,4 @@ declare const getHomePage: (path?: string, basename?: string, customRoutes?: Rec
800
812
  declare const getCurrentPage: (routerMode?: string, basename?: string) => string;
801
813
  declare function handlePolyfill(): void;
802
814
  export { hooks } from '@tarojs/shared';
803
- export { document, getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, URL, URLSearchParams, history, location, window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, env, PROPERTY_THRESHOLD, TARO_RUNTIME, HOOKS_APP_ID, SET_DATA, PAGE_INIT, ROOT_STR, HTML, HEAD, BODY, APP, CONTAINER, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, ID, UID, CLASS, STYLE, FOCUS, VIEW, STATIC_VIEW, PURE_VIEW, PROPS, DATASET, OBJECT, VALUE, INPUT, CHANGE, CUSTOM_WRAPPER, TARGET, CURRENT_TARGET, TYPE, CONFIRM, TIME_STAMP, KEY_CODE, TOUCHMOVE, DATE, SET_TIMEOUT, COMPILE_MODE, CATCHMOVE, CATCH_VIEW, COMMENT, ON_LOAD, ON_READY, ON_SHOW, ON_HIDE, OPTIONS, EXTERNAL_CLASSES, EVENT_CALLBACK_RESULT, BEHAVIORS, A, CONTEXT_ACTIONS, Current, getCurrentInstance, eventSource, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, incrementId, isElement, isText, isComment, isHasExtractProp, isParentBinded, shortcutAttr, customWrapperCache, extend, getComponentsAlias, convertNumber2PX, throttle, addLeadingSlash, hasBasename, stripBasename, stripTrailing, stripSuffix, getHomePage, getCurrentPage, Instance, VueAppInstance, VueInstance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniTextData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options$1 as Options, TFunc, PageConfig, handlePolyfill };
815
+ export { document, getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, URL, URLSearchParams, history, location, window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, env, PROPERTY_THRESHOLD, TARO_RUNTIME, HOOKS_APP_ID, SET_DATA, PAGE_INIT, ROOT_STR, HTML, HEAD, BODY, APP, CONTAINER, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, ID, UID, CLASS, STYLE, FOCUS, VIEW, STATIC_VIEW, PURE_VIEW, PROPS, DATASET, OBJECT, VALUE, INPUT, CHANGE, CUSTOM_WRAPPER, TARGET, CURRENT_TARGET, TYPE, CONFIRM, TIME_STAMP, KEY_CODE, TOUCHMOVE, DATE, SET_TIMEOUT, COMPILE_MODE, CATCHMOVE, CATCH_VIEW, COMMENT, ON_LOAD, ON_READY, ON_SHOW, ON_HIDE, OPTIONS, EXTERNAL_CLASSES, EVENT_CALLBACK_RESULT, BEHAVIORS, A, CONTEXT_ACTIONS, Current, getCurrentInstance, eventSource, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, perf, incrementId, isElement, isText, isComment, isHasExtractProp, isParentBinded, shortcutAttr, customWrapperCache, extend, getComponentsAlias, convertNumber2PX, throttle, debounce, addLeadingSlash, hasBasename, stripBasename, stripTrailing, stripSuffix, getHomePage, getCurrentPage, Instance, VueAppInstance, VueInstance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniTextData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options$1 as Options, TFunc, PageConfig, handlePolyfill };
@@ -1,4 +1,4 @@
1
- import { noop, hooks, Events, EMPTY_OBJ, isNumber, isString, isArray, isUndefined, warn, isFunction, getComponentsAlias as getComponentsAlias$1, internalComponents, toCamelCase, isObject, ensure, isNull, toDashed, controlledComponent } from '@tarojs/shared';
1
+ import { noop, hooks, Events, EMPTY_OBJ, isNumber, isString, isArray, isUndefined, warn, isFunction, getComponentsAlias as getComponentsAlias$1, internalComponents, toCamelCase, isObject, ensure, isNull, toDashed, controlledComponent, EventChannel } from '@tarojs/shared';
2
2
  export { Events, hooks } from '@tarojs/shared';
3
3
  import { __classPrivateFieldSet, __classPrivateFieldGet } from 'tslib';
4
4
 
@@ -218,6 +218,16 @@ function throttle(fn, threshold = 250, scope) {
218
218
  }
219
219
  };
220
220
  }
221
+ function debounce(fn, ms = 250, scope) {
222
+ let timer;
223
+ return function (...args) {
224
+ const context = scope || this;
225
+ clearTimeout(timer);
226
+ timer = setTimeout(function () {
227
+ fn.apply(context, args);
228
+ }, ms);
229
+ };
230
+ }
221
231
 
222
232
  const eventCenter = hooks.call('getEventCenter', Events);
223
233
 
@@ -1298,6 +1308,7 @@ function hydrate(node) {
1298
1308
  // 初始化 SPECIAL_NODES
1299
1309
  SPECIAL_NODES || (SPECIAL_NODES = hooks.call('getSpecialNodes'));
1300
1310
  const nodeName = node.nodeName;
1311
+ let compileModeName = null;
1301
1312
  if (isText(node)) {
1302
1313
  return {
1303
1314
  sid: node.sid,
@@ -1329,11 +1340,14 @@ function hydrate(node) {
1329
1340
  propInCamelCase !== COMPILE_MODE) {
1330
1341
  data[propInCamelCase] = props[prop];
1331
1342
  }
1332
- if (nodeName === VIEW && propInCamelCase === CATCHMOVE && props[prop] !== false) {
1343
+ if (process.env.TARO_ENV !== 'swan' &&
1344
+ nodeName === VIEW &&
1345
+ propInCamelCase === CATCHMOVE &&
1346
+ props[prop] !== false) {
1333
1347
  data["nn" /* Shortcuts.NodeName */] = CATCH_VIEW;
1334
1348
  }
1335
1349
  if (propInCamelCase === COMPILE_MODE) {
1336
- data["nn" /* Shortcuts.NodeName */] = props[prop];
1350
+ compileModeName = props[prop];
1337
1351
  }
1338
1352
  }
1339
1353
  // Children
@@ -1357,6 +1371,9 @@ function hydrate(node) {
1357
1371
  }
1358
1372
  }
1359
1373
  }
1374
+ if (compileModeName !== null) {
1375
+ data["nn" /* Shortcuts.NodeName */] = compileModeName;
1376
+ }
1360
1377
  const resData = hooks.call('transferHydrateData', data, node, componentAlias);
1361
1378
  return resData || data;
1362
1379
  }
@@ -3263,6 +3280,7 @@ function cloneNode(isDeep = false) {
3263
3280
  }
3264
3281
  for (const key in this) {
3265
3282
  const value = this[key];
3283
+ // eslint-disable-next-line valid-typeof
3266
3284
  if ([PROPS, DATASET].includes(key) && typeof value === OBJECT) {
3267
3285
  newNode[key] = Object.assign({}, value);
3268
3286
  }
@@ -3502,8 +3520,10 @@ class FormElement extends TaroElement {
3502
3520
  }
3503
3521
  }
3504
3522
 
3523
+ var _Performance_instances, _Performance_parseTime;
3505
3524
  class Performance {
3506
3525
  constructor() {
3526
+ _Performance_instances.add(this);
3507
3527
  this.recorder = new Map();
3508
3528
  }
3509
3529
  start(id) {
@@ -3512,18 +3532,32 @@ class Performance {
3512
3532
  }
3513
3533
  this.recorder.set(id, Date.now());
3514
3534
  }
3515
- stop(id) {
3535
+ stop(id, now = Date.now()) {
3516
3536
  if (!options.debug) {
3517
3537
  return;
3518
3538
  }
3519
- const now = Date.now();
3520
3539
  const prev = this.recorder.get(id);
3540
+ if (!(prev >= 0))
3541
+ return;
3521
3542
  this.recorder.delete(id);
3522
3543
  const time = now - prev;
3523
3544
  // eslint-disable-next-line no-console
3524
- console.log(`${id} 时长: ${time}ms`);
3545
+ console.log(`${id} 时长: ${time}ms 开始时间:${__classPrivateFieldGet(this, _Performance_instances, "m", _Performance_parseTime).call(this, prev)} 结束时间:${__classPrivateFieldGet(this, _Performance_instances, "m", _Performance_parseTime).call(this, now)}`);
3546
+ }
3547
+ delayStop(id, delay = 500) {
3548
+ if (!options.debug) {
3549
+ return;
3550
+ }
3551
+ return debounce((now = Date.now(), cb) => {
3552
+ this.stop(id, now);
3553
+ cb === null || cb === void 0 ? void 0 : cb();
3554
+ }, delay);
3525
3555
  }
3526
3556
  }
3557
+ _Performance_instances = new WeakSet(), _Performance_parseTime = function _Performance_parseTime(time) {
3558
+ const d = new Date(time);
3559
+ return `${d.getHours()}:${d.getMinutes()}:${d.getSeconds()}.${`${d.getMilliseconds()}`.padStart(3, '0')}`;
3560
+ };
3527
3561
  const perf = new Performance();
3528
3562
 
3529
3563
  function findCustomWrapper(root, dataPathArr) {
@@ -4068,6 +4102,11 @@ function createPageConfig(component, pageName, data, pageConfig) {
4068
4102
  eventCenter.trigger(getOnHideEventKey(id));
4069
4103
  }
4070
4104
  };
4105
+ if (process.env.TARO_PLATFORM === 'web') {
4106
+ config.getOpenerEventChannel = () => {
4107
+ return EventChannel.pageChannel;
4108
+ };
4109
+ }
4071
4110
  LIFECYCLES.forEach((lifecycle) => {
4072
4111
  let isDefer = false;
4073
4112
  lifecycle = lifecycle.replace(/^defer:/, () => {
@@ -5015,5 +5054,5 @@ if (process.env.SUPPORT_TARO_POLYFILL !== 'disabled' && process.env.TARO_PLATFOR
5015
5054
  handlePolyfill();
5016
5055
  }
5017
5056
 
5018
- export { A, APP, BEHAVIORS, BODY, CATCHMOVE, CATCH_VIEW, CHANGE, CLASS, COMMENT, COMPILE_MODE, CONFIRM, CONTAINER, CONTEXT_ACTIONS, CURRENT_TARGET, CUSTOM_WRAPPER, Current, DATASET, DATE, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, EVENT_CALLBACK_RESULT, EXTERNAL_CLASSES, FOCUS, FormElement, HEAD, HOOKS_APP_ID, HTML, History, ID, INPUT, KEY_CODE, Location, MutationObserver$1 as MutationObserver, OBJECT, ON_HIDE, ON_LOAD, ON_READY, ON_SHOW, OPTIONS, PAGE_INIT, PROPERTY_THRESHOLD, PROPS, PURE_VIEW, ROOT_STR, SET_DATA, SET_TIMEOUT, STATIC_VIEW, STYLE, SVGElement, Style, TARGET, TARO_RUNTIME, TIME_STAMP, TOUCHMOVE, TYPE, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, UID, URL, URLSearchParams, VALUE, VIEW, addLeadingSlash, _caf as cancelAnimationFrame, convertNumber2PX, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, customWrapperCache, document$1 as document, env, eventCenter, eventHandler, eventSource, extend, getComponentsAlias, getComputedStyle, getCurrentInstance, getCurrentPage, getHomePage, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, handlePolyfill, hasBasename, history, hydrate, incrementId, injectPageInstance, isComment, isElement, isHasExtractProp, isParentBinded, isText, location, nav as navigator, nextTick, now, options, parseUrl, removePageInstance, _raf as requestAnimationFrame, safeExecute, shortcutAttr, stringify, stripBasename, stripSuffix, stripTrailing, throttle, window$1 as window };
5057
+ export { A, APP, BEHAVIORS, BODY, CATCHMOVE, CATCH_VIEW, CHANGE, CLASS, COMMENT, COMPILE_MODE, CONFIRM, CONTAINER, CONTEXT_ACTIONS, CURRENT_TARGET, CUSTOM_WRAPPER, Current, DATASET, DATE, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, EVENT_CALLBACK_RESULT, EXTERNAL_CLASSES, FOCUS, FormElement, HEAD, HOOKS_APP_ID, HTML, History, ID, INPUT, KEY_CODE, Location, MutationObserver$1 as MutationObserver, OBJECT, ON_HIDE, ON_LOAD, ON_READY, ON_SHOW, OPTIONS, PAGE_INIT, PROPERTY_THRESHOLD, PROPS, PURE_VIEW, ROOT_STR, SET_DATA, SET_TIMEOUT, STATIC_VIEW, STYLE, SVGElement, Style, TARGET, TARO_RUNTIME, TIME_STAMP, TOUCHMOVE, TYPE, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, UID, URL, URLSearchParams, VALUE, VIEW, addLeadingSlash, _caf as cancelAnimationFrame, convertNumber2PX, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, customWrapperCache, debounce, document$1 as document, env, eventCenter, eventHandler, eventSource, extend, getComponentsAlias, getComputedStyle, getCurrentInstance, getCurrentPage, getHomePage, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, handlePolyfill, hasBasename, history, hydrate, incrementId, injectPageInstance, isComment, isElement, isHasExtractProp, isParentBinded, isText, location, nav as navigator, nextTick, now, options, parseUrl, perf, removePageInstance, _raf as requestAnimationFrame, safeExecute, shortcutAttr, stringify, stripBasename, stripSuffix, stripTrailing, throttle, window$1 as window };
5019
5058
  //# sourceMappingURL=runtime.esm.js.map