@arms/rum-core 0.1.10 → 0.1.11
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/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/model/shell.d.ts +24 -1
- package/es/model/shell.js +54 -1
- package/es/types/client.d.ts +7 -0
- package/es/types/event.d.ts +15 -0
- package/es/types/event.js +16 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +7 -0
- package/lib/model/shell.d.ts +24 -1
- package/lib/model/shell.js +54 -1
- package/lib/types/client.d.ts +7 -0
- package/lib/types/event.d.ts +15 -0
- package/lib/types/event.js +20 -0
- package/package.json +1 -1
package/es/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import Shell from './model/shell';
|
|
|
5
5
|
export * from './model/configManager';
|
|
6
6
|
export * from './types/client';
|
|
7
7
|
export * from './types/collector';
|
|
8
|
+
export * from './types/event';
|
|
8
9
|
export * from './types/processor';
|
|
9
10
|
export * from './types/reporter';
|
|
10
11
|
export * from './types/rum-event';
|
package/es/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import Shell from './model/shell';
|
|
|
5
5
|
export * from './model/configManager';
|
|
6
6
|
export * from './types/client';
|
|
7
7
|
export * from './types/collector';
|
|
8
|
+
export * from './types/event';
|
|
8
9
|
export * from './types/processor';
|
|
9
10
|
export * from './types/reporter';
|
|
10
11
|
export * from './types/rum-event';
|
package/es/model/shell.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IClient, IConfiguration } from '../types/client';
|
|
2
2
|
import { ICollector } from '../types/collector';
|
|
3
|
-
import { RumCustomEvent, RumEvent, RumExceptionEvent, RumResourceEvent, RumViewEvent, SendEventOptions } from '../types/rum-event';
|
|
3
|
+
import { loading_type, RumCustomEvent, RumEvent, RumExceptionEvent, RumResourceEvent, RumViewEvent, SendEventOptions } from '../types/rum-event';
|
|
4
4
|
import { IShell } from '../types/shell';
|
|
5
5
|
export default abstract class Shell implements IShell {
|
|
6
6
|
client: IClient;
|
|
@@ -31,6 +31,26 @@ export default abstract class Shell implements IShell {
|
|
|
31
31
|
*/
|
|
32
32
|
abstract init(configuration: IConfiguration): Promise<Shell> | Shell;
|
|
33
33
|
sendEvent(payload: RumEvent, options?: SendEventOptions): void;
|
|
34
|
+
/**
|
|
35
|
+
* 手动开启一个新 view(手动 view 模式)。
|
|
36
|
+
*
|
|
37
|
+
* 与 PvCollector 自动 PV 的语义对齐:
|
|
38
|
+
* 1. 同名去重:与当前 view 名称相同时不创建新 view
|
|
39
|
+
* 2. emit VIEW_ENDED(结束上一 view)→ ctx.addView(写入新 view)
|
|
40
|
+
* → emit VIEW_CREATED → 上报 view 事件
|
|
41
|
+
*
|
|
42
|
+
* url / referrer 属平台概念,由调用方经 options 传入(如 browser 传 location.href)。
|
|
43
|
+
* 事件基础字段(session_id / event_id / times / view)由 session.getBaseEvent 补齐,
|
|
44
|
+
* 与自动 PV 事件结构一致。
|
|
45
|
+
*
|
|
46
|
+
* @param name view 名称(如路由模板 `/user/:id`)
|
|
47
|
+
* @param options 可选字段:url / referrer / loading_type(默认 route_change)
|
|
48
|
+
*/
|
|
49
|
+
startView(name: string, options?: {
|
|
50
|
+
url?: string;
|
|
51
|
+
referrer?: string;
|
|
52
|
+
loading_type?: loading_type;
|
|
53
|
+
}): void;
|
|
34
54
|
/**
|
|
35
55
|
* get config
|
|
36
56
|
*/
|
|
@@ -50,6 +70,9 @@ export default abstract class Shell implements IShell {
|
|
|
50
70
|
sendView(payload: RumViewEvent): void;
|
|
51
71
|
/**
|
|
52
72
|
* 自定义异常上报
|
|
73
|
+
*
|
|
74
|
+
* @param payload 异常事件或 Error 对象。若为 RumExceptionEvent 且携带 source
|
|
75
|
+
* 字段(如 'react'),则使用该值;否则默认 'custom'。
|
|
53
76
|
*/
|
|
54
77
|
sendException(payload: RumExceptionEvent | Error): void;
|
|
55
78
|
/**
|
package/es/model/shell.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
var _Shell;
|
|
2
2
|
import { RumEventType } from '../types/rum-event';
|
|
3
|
+
import { LifeCycleEventType } from '../types/event';
|
|
3
4
|
import Client from '../model/client';
|
|
4
5
|
import { isNumber, isObject } from '../utils/is';
|
|
5
6
|
var Shell = /*#__PURE__*/function () {
|
|
@@ -90,6 +91,53 @@ var Shell = /*#__PURE__*/function () {
|
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
|
|
94
|
+
/**
|
|
95
|
+
* 手动开启一个新 view(手动 view 模式)。
|
|
96
|
+
*
|
|
97
|
+
* 与 PvCollector 自动 PV 的语义对齐:
|
|
98
|
+
* 1. 同名去重:与当前 view 名称相同时不创建新 view
|
|
99
|
+
* 2. emit VIEW_ENDED(结束上一 view)→ ctx.addView(写入新 view)
|
|
100
|
+
* → emit VIEW_CREATED → 上报 view 事件
|
|
101
|
+
*
|
|
102
|
+
* url / referrer 属平台概念,由调用方经 options 传入(如 browser 传 location.href)。
|
|
103
|
+
* 事件基础字段(session_id / event_id / times / view)由 session.getBaseEvent 补齐,
|
|
104
|
+
* 与自动 PV 事件结构一致。
|
|
105
|
+
*
|
|
106
|
+
* @param name view 名称(如路由模板 `/user/:id`)
|
|
107
|
+
* @param options 可选字段:url / referrer / loading_type(默认 route_change)
|
|
108
|
+
*/;
|
|
109
|
+
_proto.startView = function startView(name, options) {
|
|
110
|
+
if (!name) return;
|
|
111
|
+
var ctx = this.client.getContext();
|
|
112
|
+
if (!ctx || !ctx.session) return;
|
|
113
|
+
var views = ctx.getViews();
|
|
114
|
+
var prevView = views && views.length ? views[views.length - 1] : undefined;
|
|
115
|
+
// 同名去重:与当前 view 名称相同时不创建新 view
|
|
116
|
+
if (prevView && prevView.name === name) return;
|
|
117
|
+
if (prevView) {
|
|
118
|
+
ctx.emitter.emit(LifeCycleEventType.VIEW_ENDED, Object.assign({
|
|
119
|
+
type: 'pv'
|
|
120
|
+
}, prevView));
|
|
121
|
+
}
|
|
122
|
+
var view = {
|
|
123
|
+
id: ctx.session.getViewId(),
|
|
124
|
+
name: name,
|
|
125
|
+
loading_type: options && options.loading_type || 'route_change'
|
|
126
|
+
};
|
|
127
|
+
ctx.addView(view);
|
|
128
|
+
var base = ctx.session.getBaseEvent ? ctx.session.getBaseEvent() : {};
|
|
129
|
+
var viewEvent = Object.assign({}, base, {
|
|
130
|
+
event_type: RumEventType.VIEW,
|
|
131
|
+
type: 'pv',
|
|
132
|
+
name: name,
|
|
133
|
+
url: options && options.url,
|
|
134
|
+
referrer: options && options.referrer,
|
|
135
|
+
loading_type: view.loading_type
|
|
136
|
+
});
|
|
137
|
+
ctx.emitter.emit(LifeCycleEventType.VIEW_CREATED, viewEvent);
|
|
138
|
+
this.sendEvent(viewEvent);
|
|
139
|
+
}
|
|
140
|
+
|
|
93
141
|
/**
|
|
94
142
|
* get config
|
|
95
143
|
*/;
|
|
@@ -143,6 +191,9 @@ var Shell = /*#__PURE__*/function () {
|
|
|
143
191
|
|
|
144
192
|
/**
|
|
145
193
|
* 自定义异常上报
|
|
194
|
+
*
|
|
195
|
+
* @param payload 异常事件或 Error 对象。若为 RumExceptionEvent 且携带 source
|
|
196
|
+
* 字段(如 'react'),则使用该值;否则默认 'custom'。
|
|
146
197
|
*/;
|
|
147
198
|
_proto.sendException = function sendException(payload) {
|
|
148
199
|
if (!payload.name || !payload.message) {
|
|
@@ -151,6 +202,8 @@ var Shell = /*#__PURE__*/function () {
|
|
|
151
202
|
var name = payload.name,
|
|
152
203
|
message = payload.message,
|
|
153
204
|
stack = payload.stack;
|
|
205
|
+
// 支持自定义 source(如 'react'),否则默认 'custom'
|
|
206
|
+
var source = payload.source || 'custom';
|
|
154
207
|
var data = Object.assign({
|
|
155
208
|
times: 1,
|
|
156
209
|
name: name,
|
|
@@ -159,7 +212,7 @@ var Shell = /*#__PURE__*/function () {
|
|
|
159
212
|
}, payload, {
|
|
160
213
|
event_type: RumEventType.EXCEPTION,
|
|
161
214
|
type: 'custom',
|
|
162
|
-
source:
|
|
215
|
+
source: source
|
|
163
216
|
});
|
|
164
217
|
this.sendEvent(data);
|
|
165
218
|
}
|
package/es/types/client.d.ts
CHANGED
|
@@ -150,6 +150,13 @@ export interface IConfiguration {
|
|
|
150
150
|
* 是否开启SDK
|
|
151
151
|
*/
|
|
152
152
|
enable?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* 手动 view 模式:开启后 SDK 不再自动采集 PV(PvCollector 跳过首屏 PV
|
|
155
|
+
* 与 history 拦截),view 生命周期由接入方通过 Shell.startView(name) 主动
|
|
156
|
+
* 控制,实现路由驱动的命名 + 计时 + 触发一体。
|
|
157
|
+
* @default false
|
|
158
|
+
*/
|
|
159
|
+
trackViewsManually?: boolean;
|
|
153
160
|
/**
|
|
154
161
|
* 项目 id
|
|
155
162
|
* v0.0.40开始,不强依赖该参数,通过Endpoint获取 service_id 确定应用
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RUM 生命周期事件枚举。
|
|
3
|
+
*
|
|
4
|
+
* 由 view 生命周期驱动,采集器通过 IContext.emitter 订阅:
|
|
5
|
+
* - VIEW_CREATED:新 view 创建(首屏或路由切换),事件体为 view 事件
|
|
6
|
+
* (含 type: 'pv'、name、loading_type 等字段)
|
|
7
|
+
* - VIEW_ENDED:上一 view 结束,事件体为 `{ type: 'pv', ...prevView }`
|
|
8
|
+
*
|
|
9
|
+
* 注:跨包使用场景(browser 等平台包从 core 导入),须保持为普通 enum:
|
|
10
|
+
* const enum 在 babel 转译链路下无法内联,跨包引用会产生运行时错误。
|
|
11
|
+
*/
|
|
12
|
+
export declare enum LifeCycleEventType {
|
|
13
|
+
VIEW_CREATED = "VIEW_CREATED",
|
|
14
|
+
VIEW_ENDED = "VIEW_ENDED"
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RUM 生命周期事件枚举。
|
|
3
|
+
*
|
|
4
|
+
* 由 view 生命周期驱动,采集器通过 IContext.emitter 订阅:
|
|
5
|
+
* - VIEW_CREATED:新 view 创建(首屏或路由切换),事件体为 view 事件
|
|
6
|
+
* (含 type: 'pv'、name、loading_type 等字段)
|
|
7
|
+
* - VIEW_ENDED:上一 view 结束,事件体为 `{ type: 'pv', ...prevView }`
|
|
8
|
+
*
|
|
9
|
+
* 注:跨包使用场景(browser 等平台包从 core 导入),须保持为普通 enum:
|
|
10
|
+
* const enum 在 babel 转译链路下无法内联,跨包引用会产生运行时错误。
|
|
11
|
+
*/
|
|
12
|
+
export var LifeCycleEventType = /*#__PURE__*/function (LifeCycleEventType) {
|
|
13
|
+
LifeCycleEventType["VIEW_CREATED"] = "VIEW_CREATED";
|
|
14
|
+
LifeCycleEventType["VIEW_ENDED"] = "VIEW_ENDED";
|
|
15
|
+
return LifeCycleEventType;
|
|
16
|
+
}({});
|
package/lib/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import Shell from './model/shell';
|
|
|
5
5
|
export * from './model/configManager';
|
|
6
6
|
export * from './types/client';
|
|
7
7
|
export * from './types/collector';
|
|
8
|
+
export * from './types/event';
|
|
8
9
|
export * from './types/processor';
|
|
9
10
|
export * from './types/reporter';
|
|
10
11
|
export * from './types/rum-event';
|
package/lib/index.js
CHANGED
|
@@ -37,6 +37,13 @@ Object.keys(_collector).forEach(function (key) {
|
|
|
37
37
|
if (key in exports && exports[key] === _collector[key]) return;
|
|
38
38
|
exports[key] = _collector[key];
|
|
39
39
|
});
|
|
40
|
+
var _event = require("./types/event");
|
|
41
|
+
Object.keys(_event).forEach(function (key) {
|
|
42
|
+
if (key === "default" || key === "__esModule") return;
|
|
43
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
44
|
+
if (key in exports && exports[key] === _event[key]) return;
|
|
45
|
+
exports[key] = _event[key];
|
|
46
|
+
});
|
|
40
47
|
var _processor = require("./types/processor");
|
|
41
48
|
Object.keys(_processor).forEach(function (key) {
|
|
42
49
|
if (key === "default" || key === "__esModule") return;
|
package/lib/model/shell.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IClient, IConfiguration } from '../types/client';
|
|
2
2
|
import { ICollector } from '../types/collector';
|
|
3
|
-
import { RumCustomEvent, RumEvent, RumExceptionEvent, RumResourceEvent, RumViewEvent, SendEventOptions } from '../types/rum-event';
|
|
3
|
+
import { loading_type, RumCustomEvent, RumEvent, RumExceptionEvent, RumResourceEvent, RumViewEvent, SendEventOptions } from '../types/rum-event';
|
|
4
4
|
import { IShell } from '../types/shell';
|
|
5
5
|
export default abstract class Shell implements IShell {
|
|
6
6
|
client: IClient;
|
|
@@ -31,6 +31,26 @@ export default abstract class Shell implements IShell {
|
|
|
31
31
|
*/
|
|
32
32
|
abstract init(configuration: IConfiguration): Promise<Shell> | Shell;
|
|
33
33
|
sendEvent(payload: RumEvent, options?: SendEventOptions): void;
|
|
34
|
+
/**
|
|
35
|
+
* 手动开启一个新 view(手动 view 模式)。
|
|
36
|
+
*
|
|
37
|
+
* 与 PvCollector 自动 PV 的语义对齐:
|
|
38
|
+
* 1. 同名去重:与当前 view 名称相同时不创建新 view
|
|
39
|
+
* 2. emit VIEW_ENDED(结束上一 view)→ ctx.addView(写入新 view)
|
|
40
|
+
* → emit VIEW_CREATED → 上报 view 事件
|
|
41
|
+
*
|
|
42
|
+
* url / referrer 属平台概念,由调用方经 options 传入(如 browser 传 location.href)。
|
|
43
|
+
* 事件基础字段(session_id / event_id / times / view)由 session.getBaseEvent 补齐,
|
|
44
|
+
* 与自动 PV 事件结构一致。
|
|
45
|
+
*
|
|
46
|
+
* @param name view 名称(如路由模板 `/user/:id`)
|
|
47
|
+
* @param options 可选字段:url / referrer / loading_type(默认 route_change)
|
|
48
|
+
*/
|
|
49
|
+
startView(name: string, options?: {
|
|
50
|
+
url?: string;
|
|
51
|
+
referrer?: string;
|
|
52
|
+
loading_type?: loading_type;
|
|
53
|
+
}): void;
|
|
34
54
|
/**
|
|
35
55
|
* get config
|
|
36
56
|
*/
|
|
@@ -50,6 +70,9 @@ export default abstract class Shell implements IShell {
|
|
|
50
70
|
sendView(payload: RumViewEvent): void;
|
|
51
71
|
/**
|
|
52
72
|
* 自定义异常上报
|
|
73
|
+
*
|
|
74
|
+
* @param payload 异常事件或 Error 对象。若为 RumExceptionEvent 且携带 source
|
|
75
|
+
* 字段(如 'react'),则使用该值;否则默认 'custom'。
|
|
53
76
|
*/
|
|
54
77
|
sendException(payload: RumExceptionEvent | Error): void;
|
|
55
78
|
/**
|
package/lib/model/shell.js
CHANGED
|
@@ -4,6 +4,7 @@ function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}
|
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports["default"] = void 0;
|
|
6
6
|
var _rumEvent = require("../types/rum-event");
|
|
7
|
+
var _event = require("../types/event");
|
|
7
8
|
var _client = _interopRequireDefault(require("../model/client"));
|
|
8
9
|
var _is = require("../utils/is");
|
|
9
10
|
var _Shell;
|
|
@@ -95,6 +96,53 @@ var Shell = exports["default"] = /*#__PURE__*/function () {
|
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
98
|
|
|
99
|
+
/**
|
|
100
|
+
* 手动开启一个新 view(手动 view 模式)。
|
|
101
|
+
*
|
|
102
|
+
* 与 PvCollector 自动 PV 的语义对齐:
|
|
103
|
+
* 1. 同名去重:与当前 view 名称相同时不创建新 view
|
|
104
|
+
* 2. emit VIEW_ENDED(结束上一 view)→ ctx.addView(写入新 view)
|
|
105
|
+
* → emit VIEW_CREATED → 上报 view 事件
|
|
106
|
+
*
|
|
107
|
+
* url / referrer 属平台概念,由调用方经 options 传入(如 browser 传 location.href)。
|
|
108
|
+
* 事件基础字段(session_id / event_id / times / view)由 session.getBaseEvent 补齐,
|
|
109
|
+
* 与自动 PV 事件结构一致。
|
|
110
|
+
*
|
|
111
|
+
* @param name view 名称(如路由模板 `/user/:id`)
|
|
112
|
+
* @param options 可选字段:url / referrer / loading_type(默认 route_change)
|
|
113
|
+
*/;
|
|
114
|
+
_proto.startView = function startView(name, options) {
|
|
115
|
+
if (!name) return;
|
|
116
|
+
var ctx = this.client.getContext();
|
|
117
|
+
if (!ctx || !ctx.session) return;
|
|
118
|
+
var views = ctx.getViews();
|
|
119
|
+
var prevView = views && views.length ? views[views.length - 1] : undefined;
|
|
120
|
+
// 同名去重:与当前 view 名称相同时不创建新 view
|
|
121
|
+
if (prevView && prevView.name === name) return;
|
|
122
|
+
if (prevView) {
|
|
123
|
+
ctx.emitter.emit(_event.LifeCycleEventType.VIEW_ENDED, Object.assign({
|
|
124
|
+
type: 'pv'
|
|
125
|
+
}, prevView));
|
|
126
|
+
}
|
|
127
|
+
var view = {
|
|
128
|
+
id: ctx.session.getViewId(),
|
|
129
|
+
name: name,
|
|
130
|
+
loading_type: options && options.loading_type || 'route_change'
|
|
131
|
+
};
|
|
132
|
+
ctx.addView(view);
|
|
133
|
+
var base = ctx.session.getBaseEvent ? ctx.session.getBaseEvent() : {};
|
|
134
|
+
var viewEvent = Object.assign({}, base, {
|
|
135
|
+
event_type: _rumEvent.RumEventType.VIEW,
|
|
136
|
+
type: 'pv',
|
|
137
|
+
name: name,
|
|
138
|
+
url: options && options.url,
|
|
139
|
+
referrer: options && options.referrer,
|
|
140
|
+
loading_type: view.loading_type
|
|
141
|
+
});
|
|
142
|
+
ctx.emitter.emit(_event.LifeCycleEventType.VIEW_CREATED, viewEvent);
|
|
143
|
+
this.sendEvent(viewEvent);
|
|
144
|
+
}
|
|
145
|
+
|
|
98
146
|
/**
|
|
99
147
|
* get config
|
|
100
148
|
*/;
|
|
@@ -148,6 +196,9 @@ var Shell = exports["default"] = /*#__PURE__*/function () {
|
|
|
148
196
|
|
|
149
197
|
/**
|
|
150
198
|
* 自定义异常上报
|
|
199
|
+
*
|
|
200
|
+
* @param payload 异常事件或 Error 对象。若为 RumExceptionEvent 且携带 source
|
|
201
|
+
* 字段(如 'react'),则使用该值;否则默认 'custom'。
|
|
151
202
|
*/;
|
|
152
203
|
_proto.sendException = function sendException(payload) {
|
|
153
204
|
if (!payload.name || !payload.message) {
|
|
@@ -156,6 +207,8 @@ var Shell = exports["default"] = /*#__PURE__*/function () {
|
|
|
156
207
|
var name = payload.name,
|
|
157
208
|
message = payload.message,
|
|
158
209
|
stack = payload.stack;
|
|
210
|
+
// 支持自定义 source(如 'react'),否则默认 'custom'
|
|
211
|
+
var source = payload.source || 'custom';
|
|
159
212
|
var data = Object.assign({
|
|
160
213
|
times: 1,
|
|
161
214
|
name: name,
|
|
@@ -164,7 +217,7 @@ var Shell = exports["default"] = /*#__PURE__*/function () {
|
|
|
164
217
|
}, payload, {
|
|
165
218
|
event_type: _rumEvent.RumEventType.EXCEPTION,
|
|
166
219
|
type: 'custom',
|
|
167
|
-
source:
|
|
220
|
+
source: source
|
|
168
221
|
});
|
|
169
222
|
this.sendEvent(data);
|
|
170
223
|
}
|
package/lib/types/client.d.ts
CHANGED
|
@@ -150,6 +150,13 @@ export interface IConfiguration {
|
|
|
150
150
|
* 是否开启SDK
|
|
151
151
|
*/
|
|
152
152
|
enable?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* 手动 view 模式:开启后 SDK 不再自动采集 PV(PvCollector 跳过首屏 PV
|
|
155
|
+
* 与 history 拦截),view 生命周期由接入方通过 Shell.startView(name) 主动
|
|
156
|
+
* 控制,实现路由驱动的命名 + 计时 + 触发一体。
|
|
157
|
+
* @default false
|
|
158
|
+
*/
|
|
159
|
+
trackViewsManually?: boolean;
|
|
153
160
|
/**
|
|
154
161
|
* 项目 id
|
|
155
162
|
* v0.0.40开始,不强依赖该参数,通过Endpoint获取 service_id 确定应用
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RUM 生命周期事件枚举。
|
|
3
|
+
*
|
|
4
|
+
* 由 view 生命周期驱动,采集器通过 IContext.emitter 订阅:
|
|
5
|
+
* - VIEW_CREATED:新 view 创建(首屏或路由切换),事件体为 view 事件
|
|
6
|
+
* (含 type: 'pv'、name、loading_type 等字段)
|
|
7
|
+
* - VIEW_ENDED:上一 view 结束,事件体为 `{ type: 'pv', ...prevView }`
|
|
8
|
+
*
|
|
9
|
+
* 注:跨包使用场景(browser 等平台包从 core 导入),须保持为普通 enum:
|
|
10
|
+
* const enum 在 babel 转译链路下无法内联,跨包引用会产生运行时错误。
|
|
11
|
+
*/
|
|
12
|
+
export declare enum LifeCycleEventType {
|
|
13
|
+
VIEW_CREATED = "VIEW_CREATED",
|
|
14
|
+
VIEW_ENDED = "VIEW_ENDED"
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.LifeCycleEventType = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* RUM 生命周期事件枚举。
|
|
7
|
+
*
|
|
8
|
+
* 由 view 生命周期驱动,采集器通过 IContext.emitter 订阅:
|
|
9
|
+
* - VIEW_CREATED:新 view 创建(首屏或路由切换),事件体为 view 事件
|
|
10
|
+
* (含 type: 'pv'、name、loading_type 等字段)
|
|
11
|
+
* - VIEW_ENDED:上一 view 结束,事件体为 `{ type: 'pv', ...prevView }`
|
|
12
|
+
*
|
|
13
|
+
* 注:跨包使用场景(browser 等平台包从 core 导入),须保持为普通 enum:
|
|
14
|
+
* const enum 在 babel 转译链路下无法内联,跨包引用会产生运行时错误。
|
|
15
|
+
*/
|
|
16
|
+
var LifeCycleEventType = exports.LifeCycleEventType = /*#__PURE__*/function (LifeCycleEventType) {
|
|
17
|
+
LifeCycleEventType["VIEW_CREATED"] = "VIEW_CREATED";
|
|
18
|
+
LifeCycleEventType["VIEW_ENDED"] = "VIEW_ENDED";
|
|
19
|
+
return LifeCycleEventType;
|
|
20
|
+
}({});
|