@next-core/brick-kit 2.199.1 → 2.199.2

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.esm.js CHANGED
@@ -1432,9 +1432,16 @@ function StoryboardFunctionRegistryFactory() {
1432
1432
  }
1433
1433
  });
1434
1434
  var currentApp;
1435
+ var needPerf = false;
1435
1436
  function registerStoryboardFunctions(functions, app) {
1436
1437
  if (app) {
1438
+ var _app$config, _app$config$settings;
1437
1439
  currentApp = app;
1440
+ needPerf = app === null || app === void 0 ? void 0 : (_app$config = app.config) === null || _app$config === void 0 ? void 0 : (_app$config$settings = _app$config.settings) === null || _app$config$settings === void 0 ? void 0 : _app$config$settings.perfStoryboardFunctions;
1441
+ if (needPerf) {
1442
+ // Clear perf data when initialize functions.
1443
+ window.STORYBOARD_FUNCTIONS_PERF = [];
1444
+ }
1438
1445
  }
1439
1446
  registeredFunctions.clear();
1440
1447
  if (Array.isArray(functions)) {
@@ -1476,11 +1483,15 @@ function StoryboardFunctionRegistryFactory() {
1476
1483
  storyboardFunctions,
1477
1484
  isStoryboardFunction: true
1478
1485
  }), !!collectCoverage),
1479
- hooks: collector && {
1486
+ hooks: _objectSpread({
1487
+ perfCall: needPerf ? duration => {
1488
+ perf(name, fn.source, duration);
1489
+ } : undefined
1490
+ }, collector ? {
1480
1491
  beforeEvaluate: collector.beforeEvaluate,
1481
1492
  beforeCall: collector.beforeCall,
1482
1493
  beforeBranch: collector.beforeBranch
1483
- }
1494
+ } : null)
1484
1495
  });
1485
1496
  fn.processed = true;
1486
1497
  return fn.cooked;
@@ -1496,6 +1507,19 @@ function StoryboardFunctionRegistryFactory() {
1496
1507
  }
1497
1508
  };
1498
1509
  }
1510
+ function perf(name, source, duration) {
1511
+ var _window, _window$STORYBOARD_FU;
1512
+ var list = (_window$STORYBOARD_FU = (_window = window).STORYBOARD_FUNCTIONS_PERF) !== null && _window$STORYBOARD_FU !== void 0 ? _window$STORYBOARD_FU : _window.STORYBOARD_FUNCTIONS_PERF = [];
1513
+ var data = list.find(item => item.name === name);
1514
+ if (!data) {
1515
+ list.push(data = {
1516
+ name,
1517
+ durations: [],
1518
+ source
1519
+ });
1520
+ }
1521
+ data.durations.push(Math.round(duration * 1000));
1522
+ }
1499
1523
 
1500
1524
  var {
1501
1525
  storyboardFunctions,