@cloudcare/rum-uniapp 2.1.4 → 2.1.5

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.
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.buildEnv = void 0;
7
7
  var buildEnv = {
8
- sdkVersion: '2.1.4',
8
+ sdkVersion: '2.1.5',
9
9
  sdkName: 'df_uniapp_rum_sdk'
10
10
  };
11
11
  exports.buildEnv = buildEnv;
@@ -45,6 +45,9 @@ var makeRum = function makeRum(startRumImpl) {
45
45
  addActionStrategy = _startRumImpl.addAction;
46
46
  isAlreadyInitialized = true;
47
47
  },
48
+ initVue3: function initVue3(userConfiguration) {
49
+ this.init({}, userConfiguration);
50
+ },
48
51
  getInternalContext: function getInternalContext(startTime) {
49
52
  return _getInternalContext(startTime);
50
53
  },
@@ -15,57 +15,41 @@ var _trackPageActiveites = require("../trackPageActiveites");
15
15
 
16
16
  var _enums = require("../../helper/enums");
17
17
 
18
+ var _sdk = require("../../core/sdk");
19
+
20
+ var WHITE_METHOD = ['setup'];
21
+
18
22
  function trackActions(lifeCycle, Vue) {
19
23
  var action = startActionManagement(lifeCycle); // New views trigger the discard of the current pending Action
20
24
 
21
25
  lifeCycle.subscribe(_lifeCycle.LifeCycleEventType.VIEW_CREATED, function () {
22
26
  action.discardCurrent();
23
27
  });
24
- var originVueExtend = Vue.extend;
25
-
26
- Vue.extend = function (vueOptions) {
27
- // methods 方法
28
- if (vueOptions.methods) {
29
- var vueMethods = Object.keys(vueOptions.methods);
30
- vueMethods.forEach(function (methodName) {
31
- clickProxy(vueOptions.methods, methodName, function (_action) {
32
- action.create(_action.type, _action.name);
33
- }, lifeCycle);
34
- });
35
- }
36
28
 
37
- var originMethods = (0, _utils.getMethods)(vueOptions);
38
- originMethods.forEach(function (methodName) {
39
- clickProxy(vueOptions, methodName, function (_action) {
40
- action.create(_action.type, _action.name);
41
- }, lifeCycle);
42
- });
43
- return originVueExtend.call(this, vueOptions);
44
- }; // var originPage = Page
45
- // Page = function (page) {
46
- // const methods = getMethods(page)
47
- // methods.forEach((methodName) => {
48
- // clickProxy(
49
- // page,
50
- // methodName,
51
- // function (_action) {
52
- // action.create(_action.type, _action.name)
53
- // },
54
- // lifeCycle,
55
- // )
56
- // })
57
- // return originPage(page)
58
- // }
59
- // var originComponent = Component
60
- // Component = function (component) {
61
- // const methods = getMethods(component)
62
- // methods.forEach((methodName) => {
63
- // clickProxy(component, methodName, function (_action) {
64
- // action.create(_action.type, _action.name)
65
- // })
66
- // })
67
- // return originComponent(component)
68
- // }
29
+ if (Vue && Vue.extend) {
30
+ var originVueExtend = Vue.extend;
31
+
32
+ Vue.extend = function (vueOptions) {
33
+ proxyInstance(vueOptions, action, lifeCycle);
34
+ return originVueExtend.call(this, vueOptions);
35
+ };
36
+ } else {
37
+ if (!_sdk.tracker) return;
38
+ var originCreatePage = _sdk.tracker.createPage;
39
+
40
+ _sdk.tracker.createPage = function (page) {
41
+ // methods 方法
42
+ proxyInstance(page, action, lifeCycle);
43
+ return originCreatePage.call(this, page);
44
+ };
45
+
46
+ var originCreateComponent = _sdk.tracker.createComponent;
47
+
48
+ _sdk.tracker.createComponent = function (component) {
49
+ proxyInstance(component, action, lifeCycle);
50
+ return originCreateComponent.call(this, component);
51
+ };
52
+ } // var originVueExtend = Vue.extend
69
53
 
70
54
 
71
55
  return {
@@ -75,11 +59,31 @@ function trackActions(lifeCycle, Vue) {
75
59
  };
76
60
  }
77
61
 
78
- function clickProxy(page, methodName, callback, lifeCycle) {
79
- var oirginMethod = page[methodName];
62
+ function proxyInstance(options, action, lifeCycle) {
63
+ // methods 方法
64
+ if (options.methods) {
65
+ var vueMethods = Object.keys(options.methods);
66
+ vueMethods.forEach(function (methodName) {
67
+ clickProxy(options.methods, methodName, function (_action) {
68
+ action.create(_action.type, _action.name);
69
+ }, lifeCycle);
70
+ });
71
+ }
72
+
73
+ var originMethods = (0, _utils.getMethods)(options);
74
+ originMethods.forEach(function (methodName) {
75
+ clickProxy(options, methodName, function (_action) {
76
+ action.create(_action.type, _action.name);
77
+ }, lifeCycle);
78
+ });
79
+ }
80
+
81
+ function clickProxy(origin, methodName, callback, lifeCycle) {
82
+ if (WHITE_METHOD.indexOf(methodName) > -1) return;
83
+ var originMethod = origin[methodName];
80
84
 
81
- page[methodName] = function () {
82
- var result = oirginMethod.apply(this, arguments);
85
+ origin[methodName] = function () {
86
+ var result = originMethod.apply(this, arguments);
83
87
  var action = {};
84
88
 
85
89
  if ((0, _utils.isObject)(arguments[0])) {
@@ -12,51 +12,65 @@ var _trackEventCounts2 = require("../trackEventCounts");
12
12
 
13
13
  var _lifeCycle = require("../../core/lifeCycle");
14
14
 
15
- var _sdk = require("../../core/sdk");
16
-
17
15
  // 劫持原小程序App方法
18
16
  var THROTTLE_VIEW_UPDATE_PERIOD = 3000;
19
17
  exports.THROTTLE_VIEW_UPDATE_PERIOD = THROTTLE_VIEW_UPDATE_PERIOD;
20
18
 
21
- function rewritePage(configuration, lifeCycle, Vue) {
22
- var originVueExtend = Vue.extend;
23
-
24
- Vue.extend = function (vueOptions) {
25
- // 合并方法,插入记录脚本
26
- var currentView,
27
- startTime = (0, _utils.now)();
28
- ['onReady', 'onShow', 'onLoad', 'onUnload', 'onHide'].forEach(function (methodName) {
29
- var userDefinedMethod = vueOptions[methodName];
30
-
31
- vueOptions[methodName] = function () {
32
- if (this.mpType !== 'page') {
33
- return userDefinedMethod && userDefinedMethod.apply(this, arguments);
34
- } // 只处理page类型
35
-
36
-
37
- if (methodName === 'onShow' || methodName === 'onLoad') {
38
- if (typeof currentView === 'undefined') {
39
- var activePage = (0, _utils.getActivePage)();
40
- currentView = newView(lifeCycle, activePage && activePage.route, startTime);
41
- }
19
+ function proxyPage(pageOptions, lifeCycle) {
20
+ // 合并方法,插入记录脚本
21
+ var currentView,
22
+ startTime = (0, _utils.now)();
23
+ ['onReady', 'onShow', 'onLoad', 'onUnload', 'onHide'].forEach(function (methodName) {
24
+ var userDefinedMethod = pageOptions[methodName];
25
+ if (typeof userDefinedMethod !== 'function') return;
26
+
27
+ pageOptions[methodName] = function () {
28
+ var mpType = this.mpType || this.$vm.mpType;
29
+
30
+ if (mpType !== 'page') {
31
+ return userDefinedMethod && userDefinedMethod.apply(this, arguments);
32
+ } // 只处理page类型
33
+
34
+
35
+ if (methodName === 'onShow' || methodName === 'onLoad') {
36
+ if (typeof currentView === 'undefined') {
37
+ var activePage = (0, _utils.getActivePage)();
38
+ currentView = newView(lifeCycle, activePage && activePage.route, startTime);
42
39
  }
40
+ }
43
41
 
44
- currentView && currentView.setLoadEventEnd(methodName);
42
+ currentView && currentView.setLoadEventEnd(methodName);
45
43
 
46
- if ((methodName === 'onUnload' || methodName === 'onHide' || methodName === 'onShow') && currentView) {
47
- currentView.triggerUpdate();
44
+ if ((methodName === 'onUnload' || methodName === 'onHide' || methodName === 'onShow') && currentView) {
45
+ currentView.triggerUpdate();
48
46
 
49
- if (methodName === 'onUnload' || methodName === 'onHide') {
50
- currentView.end();
51
- currentView = undefined;
52
- }
47
+ if (methodName === 'onUnload' || methodName === 'onHide') {
48
+ currentView.end();
49
+ currentView = undefined;
53
50
  }
51
+ }
54
52
 
55
- return userDefinedMethod && userDefinedMethod.apply(this, arguments);
56
- };
57
- });
58
- return originVueExtend.call(this, vueOptions);
59
- };
53
+ return userDefinedMethod && userDefinedMethod.apply(this, arguments);
54
+ };
55
+ });
56
+ }
57
+
58
+ function rewritePage(configuration, lifeCycle, Vue) {
59
+ if (Vue && Vue.extend) {
60
+ var originVueExtend = Vue.extend;
61
+
62
+ Vue.extend = function (vueOptions) {
63
+ proxyPage(vueOptions, lifeCycle);
64
+ return originVueExtend.call(this, vueOptions);
65
+ };
66
+ } else {
67
+ var originComponent = Component;
68
+
69
+ Component = function Component(pageOptions) {
70
+ proxyPage(pageOptions.methods, lifeCycle);
71
+ return originComponent.call(this, pageOptions);
72
+ };
73
+ }
60
74
  }
61
75
 
62
76
  function newView(lifeCycle, route, startTime) {
@@ -9,6 +9,8 @@ var _lifeCycle = require("../core/lifeCycle");
9
9
 
10
10
  var _utils = require("../helper/utils");
11
11
 
12
+ var _sdk = require("../core/sdk");
13
+
12
14
  function resetSetData(data, callback, lifeCycle, mpInstance) {
13
15
  var pendingStartTimestamp = (0, _utils.now)();
14
16
 
@@ -26,36 +28,56 @@ function resetSetData(data, callback, lifeCycle, mpInstance) {
26
28
  return _callback;
27
29
  }
28
30
 
29
- function startSetDataColloction(lifeCycle, Vue) {
30
- var originVueExtend = Vue.extend;
31
-
32
- Vue.extend = function (vueOptions) {
33
- var userDefinedMethod = vueOptions['onLoad'];
31
+ function proxyPage(pageOptions, lifeCycle) {
32
+ var userDefinedMethod = pageOptions['onLoad'];
34
33
 
35
- vueOptions['onLoad'] = function () {
36
- var mpInstance = this.$scope;
37
- var setData = mpInstance.setData; // 重写setData
34
+ pageOptions['onLoad'] = function () {
35
+ var mpInstance = this.$scope;
36
+ var setData = mpInstance.setData;
38
37
 
39
- if (typeof setData === 'function') {
40
- try {
41
- // 这里暂时这么处理 只读属性 会抛出错误
42
- mpInstance.setData = function (data, callback) {
38
+ if (typeof setData === 'function') {
39
+ try {
40
+ // 这里暂时这么处理 只读属性 会抛出错误
41
+ mpInstance.setData = function (data, callback) {
42
+ return setData.call(mpInstance, data, resetSetData(data, callback, lifeCycle, mpInstance));
43
+ };
44
+ } catch (err) {
45
+ Object.defineProperty(mpInstance.__proto__, 'setData', {
46
+ configurable: false,
47
+ enumerable: false,
48
+ value: function value(data, callback) {
43
49
  return setData.call(mpInstance, data, resetSetData(data, callback, lifeCycle, mpInstance));
44
- };
45
- } catch (err) {
46
- Object.defineProperty(mpInstance.__proto__, 'setData', {
47
- configurable: false,
48
- enumerable: false,
49
- value: function value(data, callback) {
50
- return setData.call(mpInstance, data, resetSetData(data, callback, lifeCycle, mpInstance));
51
- }
52
- });
53
- }
50
+ }
51
+ });
54
52
  }
53
+ }
54
+
55
+ return userDefinedMethod && userDefinedMethod.apply(this, arguments);
56
+ };
57
+ }
55
58
 
56
- return userDefinedMethod && userDefinedMethod.apply(this, arguments);
59
+ function startSetDataColloction(lifeCycle, Vue) {
60
+ if (Vue && Vue.extend) {
61
+ var originVueExtend = Vue.extend;
62
+
63
+ Vue.extend = function (vueOptions) {
64
+ proxyPage(vueOptions, lifeCycle);
65
+ return originVueExtend.call(this, vueOptions);
57
66
  };
67
+ } else {
68
+ if (!_sdk.tracker) return;
69
+ var originCreatePage = _sdk.tracker.createPage;
58
70
 
59
- return originVueExtend.call(this, vueOptions);
60
- };
71
+ _sdk.tracker.createPage = function (pageOptions) {
72
+ proxyPage(pageOptions, lifeCycle);
73
+ return originCreatePage.call(this, pageOptions);
74
+ };
75
+
76
+ var originCreateComponent = _sdk.tracker.createComponent;
77
+
78
+ _sdk.tracker.createComponent = function (component) {
79
+ proxyPage(component, lifeCycle);
80
+ return originCreateComponent.call(this, component);
81
+ };
82
+ }
61
83
  }
@@ -1,4 +1,4 @@
1
1
  export var buildEnv = {
2
- sdkVersion: '2.1.4',
2
+ sdkVersion: '2.1.5',
3
3
  sdkName: 'df_uniapp_rum_sdk'
4
4
  };
@@ -33,6 +33,9 @@ export var makeRum = function makeRum(startRumImpl) {
33
33
  addActionStrategy = _startRumImpl.addAction;
34
34
  isAlreadyInitialized = true;
35
35
  },
36
+ initVue3: function initVue3(userConfiguration) {
37
+ this.init({}, userConfiguration);
38
+ },
36
39
  getInternalContext: function getInternalContext(startTime) {
37
40
  return _getInternalContext(startTime);
38
41
  },
@@ -3,57 +3,39 @@ import { LifeCycleEventType } from '../../core/lifeCycle';
3
3
  import { trackEventCounts } from '../trackEventCounts';
4
4
  import { waitIdlePageActivity } from '../trackPageActiveites';
5
5
  import { ActionType } from '../../helper/enums';
6
+ import { tracker } from '../../core/sdk';
7
+ var WHITE_METHOD = ['setup'];
6
8
  export function trackActions(lifeCycle, Vue) {
7
9
  var action = startActionManagement(lifeCycle); // New views trigger the discard of the current pending Action
8
10
 
9
11
  lifeCycle.subscribe(LifeCycleEventType.VIEW_CREATED, function () {
10
12
  action.discardCurrent();
11
13
  });
12
- var originVueExtend = Vue.extend;
13
-
14
- Vue.extend = function (vueOptions) {
15
- // methods 方法
16
- if (vueOptions.methods) {
17
- var vueMethods = Object.keys(vueOptions.methods);
18
- vueMethods.forEach(methodName => {
19
- clickProxy(vueOptions.methods, methodName, function (_action) {
20
- action.create(_action.type, _action.name);
21
- }, lifeCycle);
22
- });
23
- }
24
14
 
25
- var originMethods = getMethods(vueOptions);
26
- originMethods.forEach(methodName => {
27
- clickProxy(vueOptions, methodName, function (_action) {
28
- action.create(_action.type, _action.name);
29
- }, lifeCycle);
30
- });
31
- return originVueExtend.call(this, vueOptions);
32
- }; // var originPage = Page
33
- // Page = function (page) {
34
- // const methods = getMethods(page)
35
- // methods.forEach((methodName) => {
36
- // clickProxy(
37
- // page,
38
- // methodName,
39
- // function (_action) {
40
- // action.create(_action.type, _action.name)
41
- // },
42
- // lifeCycle,
43
- // )
44
- // })
45
- // return originPage(page)
46
- // }
47
- // var originComponent = Component
48
- // Component = function (component) {
49
- // const methods = getMethods(component)
50
- // methods.forEach((methodName) => {
51
- // clickProxy(component, methodName, function (_action) {
52
- // action.create(_action.type, _action.name)
53
- // })
54
- // })
55
- // return originComponent(component)
56
- // }
15
+ if (Vue && Vue.extend) {
16
+ var originVueExtend = Vue.extend;
17
+
18
+ Vue.extend = function (vueOptions) {
19
+ proxyInstance(vueOptions, action, lifeCycle);
20
+ return originVueExtend.call(this, vueOptions);
21
+ };
22
+ } else {
23
+ if (!tracker) return;
24
+ var originCreatePage = tracker.createPage;
25
+
26
+ tracker.createPage = function (page) {
27
+ // methods 方法
28
+ proxyInstance(page, action, lifeCycle);
29
+ return originCreatePage.call(this, page);
30
+ };
31
+
32
+ var originCreateComponent = tracker.createComponent;
33
+
34
+ tracker.createComponent = function (component) {
35
+ proxyInstance(component, action, lifeCycle);
36
+ return originCreateComponent.call(this, component);
37
+ };
38
+ } // var originVueExtend = Vue.extend
57
39
 
58
40
 
59
41
  return {
@@ -63,11 +45,31 @@ export function trackActions(lifeCycle, Vue) {
63
45
  };
64
46
  }
65
47
 
66
- function clickProxy(page, methodName, callback, lifeCycle) {
67
- var oirginMethod = page[methodName];
48
+ function proxyInstance(options, action, lifeCycle) {
49
+ // methods 方法
50
+ if (options.methods) {
51
+ var vueMethods = Object.keys(options.methods);
52
+ vueMethods.forEach(methodName => {
53
+ clickProxy(options.methods, methodName, function (_action) {
54
+ action.create(_action.type, _action.name);
55
+ }, lifeCycle);
56
+ });
57
+ }
58
+
59
+ var originMethods = getMethods(options);
60
+ originMethods.forEach(methodName => {
61
+ clickProxy(options, methodName, function (_action) {
62
+ action.create(_action.type, _action.name);
63
+ }, lifeCycle);
64
+ });
65
+ }
66
+
67
+ function clickProxy(origin, methodName, callback, lifeCycle) {
68
+ if (WHITE_METHOD.indexOf(methodName) > -1) return;
69
+ var originMethod = origin[methodName];
68
70
 
69
- page[methodName] = function () {
70
- var result = oirginMethod.apply(this, arguments);
71
+ origin[methodName] = function () {
72
+ var result = originMethod.apply(this, arguments);
71
73
  var action = {};
72
74
 
73
75
  if (isObject(arguments[0])) {
@@ -1,48 +1,64 @@
1
- import { extend, now, throttle, UUID, isNumber, getActivePage } from '../../helper/utils';
1
+ import { type, now, throttle, UUID, isNumber, getActivePage } from '../../helper/utils';
2
2
  import { trackEventCounts } from '../trackEventCounts';
3
- import { LifeCycleEventType } from '../../core/lifeCycle';
4
- import { sdk } from '../../core/sdk'; // 劫持原小程序App方法
3
+ import { LifeCycleEventType } from '../../core/lifeCycle'; // 劫持原小程序App方法
5
4
 
6
5
  export var THROTTLE_VIEW_UPDATE_PERIOD = 3000;
7
- export function rewritePage(configuration, lifeCycle, Vue) {
8
- var originVueExtend = Vue.extend;
9
-
10
- Vue.extend = function (vueOptions) {
11
- // 合并方法,插入记录脚本
12
- var currentView,
13
- startTime = now();
14
- ['onReady', 'onShow', 'onLoad', 'onUnload', 'onHide'].forEach(methodName => {
15
- var userDefinedMethod = vueOptions[methodName];
16
-
17
- vueOptions[methodName] = function () {
18
- if (this.mpType !== 'page') {
19
- return userDefinedMethod && userDefinedMethod.apply(this, arguments);
20
- } // 只处理page类型
21
-
22
-
23
- if (methodName === 'onShow' || methodName === 'onLoad') {
24
- if (typeof currentView === 'undefined') {
25
- var activePage = getActivePage();
26
- currentView = newView(lifeCycle, activePage && activePage.route, startTime);
27
- }
6
+
7
+ function proxyPage(pageOptions, lifeCycle) {
8
+ // 合并方法,插入记录脚本
9
+ var currentView,
10
+ startTime = now();
11
+ ['onReady', 'onShow', 'onLoad', 'onUnload', 'onHide'].forEach(methodName => {
12
+ var userDefinedMethod = pageOptions[methodName];
13
+ if (typeof userDefinedMethod !== 'function') return;
14
+
15
+ pageOptions[methodName] = function () {
16
+ var mpType = this.mpType || this.$vm.mpType;
17
+
18
+ if (mpType !== 'page') {
19
+ return userDefinedMethod && userDefinedMethod.apply(this, arguments);
20
+ } // 只处理page类型
21
+
22
+
23
+ if (methodName === 'onShow' || methodName === 'onLoad') {
24
+ if (typeof currentView === 'undefined') {
25
+ var activePage = getActivePage();
26
+ currentView = newView(lifeCycle, activePage && activePage.route, startTime);
28
27
  }
28
+ }
29
29
 
30
- currentView && currentView.setLoadEventEnd(methodName);
30
+ currentView && currentView.setLoadEventEnd(methodName);
31
31
 
32
- if ((methodName === 'onUnload' || methodName === 'onHide' || methodName === 'onShow') && currentView) {
33
- currentView.triggerUpdate();
32
+ if ((methodName === 'onUnload' || methodName === 'onHide' || methodName === 'onShow') && currentView) {
33
+ currentView.triggerUpdate();
34
34
 
35
- if (methodName === 'onUnload' || methodName === 'onHide') {
36
- currentView.end();
37
- currentView = undefined;
38
- }
35
+ if (methodName === 'onUnload' || methodName === 'onHide') {
36
+ currentView.end();
37
+ currentView = undefined;
39
38
  }
39
+ }
40
40
 
41
- return userDefinedMethod && userDefinedMethod.apply(this, arguments);
42
- };
43
- });
44
- return originVueExtend.call(this, vueOptions);
45
- };
41
+ return userDefinedMethod && userDefinedMethod.apply(this, arguments);
42
+ };
43
+ });
44
+ }
45
+
46
+ export function rewritePage(configuration, lifeCycle, Vue) {
47
+ if (Vue && Vue.extend) {
48
+ var originVueExtend = Vue.extend;
49
+
50
+ Vue.extend = function (vueOptions) {
51
+ proxyPage(vueOptions, lifeCycle);
52
+ return originVueExtend.call(this, vueOptions);
53
+ };
54
+ } else {
55
+ var originComponent = Component;
56
+
57
+ Component = function Component(pageOptions) {
58
+ proxyPage(pageOptions.methods, lifeCycle);
59
+ return originComponent.call(this, pageOptions);
60
+ };
61
+ }
46
62
  }
47
63
 
48
64
  function newView(lifeCycle, route, startTime) {
@@ -1,5 +1,6 @@
1
1
  import { LifeCycleEventType } from '../core/lifeCycle';
2
2
  import { now } from '../helper/utils';
3
+ import { tracker } from '../core/sdk';
3
4
 
4
5
  function resetSetData(data, callback, lifeCycle, mpInstance) {
5
6
  var pendingStartTimestamp = now();
@@ -18,36 +19,56 @@ function resetSetData(data, callback, lifeCycle, mpInstance) {
18
19
  return _callback;
19
20
  }
20
21
 
21
- export function startSetDataColloction(lifeCycle, Vue) {
22
- var originVueExtend = Vue.extend;
23
-
24
- Vue.extend = function (vueOptions) {
25
- var userDefinedMethod = vueOptions['onLoad'];
22
+ function proxyPage(pageOptions, lifeCycle) {
23
+ var userDefinedMethod = pageOptions['onLoad'];
26
24
 
27
- vueOptions['onLoad'] = function () {
28
- var mpInstance = this.$scope;
29
- var setData = mpInstance.setData; // 重写setData
25
+ pageOptions['onLoad'] = function () {
26
+ var mpInstance = this.$scope;
27
+ var setData = mpInstance.setData;
30
28
 
31
- if (typeof setData === 'function') {
32
- try {
33
- // 这里暂时这么处理 只读属性 会抛出错误
34
- mpInstance.setData = function (data, callback) {
29
+ if (typeof setData === 'function') {
30
+ try {
31
+ // 这里暂时这么处理 只读属性 会抛出错误
32
+ mpInstance.setData = function (data, callback) {
33
+ return setData.call(mpInstance, data, resetSetData(data, callback, lifeCycle, mpInstance));
34
+ };
35
+ } catch (err) {
36
+ Object.defineProperty(mpInstance.__proto__, 'setData', {
37
+ configurable: false,
38
+ enumerable: false,
39
+ value: function value(data, callback) {
35
40
  return setData.call(mpInstance, data, resetSetData(data, callback, lifeCycle, mpInstance));
36
- };
37
- } catch (err) {
38
- Object.defineProperty(mpInstance.__proto__, 'setData', {
39
- configurable: false,
40
- enumerable: false,
41
- value: function value(data, callback) {
42
- return setData.call(mpInstance, data, resetSetData(data, callback, lifeCycle, mpInstance));
43
- }
44
- });
45
- }
41
+ }
42
+ });
46
43
  }
44
+ }
47
45
 
48
- return userDefinedMethod && userDefinedMethod.apply(this, arguments);
46
+ return userDefinedMethod && userDefinedMethod.apply(this, arguments);
47
+ };
48
+ }
49
+
50
+ export function startSetDataColloction(lifeCycle, Vue) {
51
+ if (Vue && Vue.extend) {
52
+ var originVueExtend = Vue.extend;
53
+
54
+ Vue.extend = function (vueOptions) {
55
+ proxyPage(vueOptions, lifeCycle);
56
+ return originVueExtend.call(this, vueOptions);
49
57
  };
58
+ } else {
59
+ if (!tracker) return;
60
+ var originCreatePage = tracker.createPage;
50
61
 
51
- return originVueExtend.call(this, vueOptions);
52
- };
62
+ tracker.createPage = function (pageOptions) {
63
+ proxyPage(pageOptions, lifeCycle);
64
+ return originCreatePage.call(this, pageOptions);
65
+ };
66
+
67
+ var originCreateComponent = tracker.createComponent;
68
+
69
+ tracker.createComponent = function (component) {
70
+ proxyPage(component, lifeCycle);
71
+ return originCreateComponent.call(this, component);
72
+ };
73
+ }
53
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudcare/rum-uniapp",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "main": "cjs/index.js",
5
5
  "module": "esm/index.js",
6
6
  "miniprogram": "cjs",