Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rip
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fanxuehui
rip
Commits
b30763b3
Commit
b30763b3
authored
Aug 05, 2019
by
aiduck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opt
parent
086f64f7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
20 deletions
+25
-20
package-lock.json
package-lock.json
+1
-1
monitor.js
src/lib/monitor.js
+4
-2
reporter.js
src/lib/reporter.js
+15
-12
tracks.worker.js
src/lib/tracks.worker.js
+5
-5
No files found.
package-lock.json
View file @
b30763b3
{
"name"
:
"
hunter-rrweb
"
,
"name"
:
"
@tuia/rip
"
,
"version"
:
"0.0.1"
,
"lockfileVersion"
:
1
,
"requires"
:
true
,
...
...
src/lib/monitor.js
View file @
b30763b3
...
...
@@ -12,8 +12,10 @@ export default class Monitor {
payload
:
{
system
,
userIdentifier
,
env
,
log
,
config
:
{
env
,
log
,
}
},
});
}
...
...
src/lib/reporter.js
View file @
b30763b3
...
...
@@ -3,14 +3,18 @@ import Counter from "./counter";
import
{
dataWrapper
,
log
}
from
'./utils'
;
class
Reporter
{
system
=
''
;
// 系统名
// 基础配置
baseInfo
=
{
system
:
''
,
userIdentifier
:
''
,
path
:
''
,
};
// 系统配置
config
=
{
env
:
'prod'
,
log
:
false
};
// 系统配置
environmentUrl
=
''
;
// 环境
userIdentifier
=
''
;
//用户标示
path
=
''
;
// 当前路径
};
environmentUrl
=
''
;
// 环境配置
isUploading
=
false
;
// 是否在上传cdn
bus
=
[];
// 上传分片数据
counter
=
new
Counter
();
// 计数器和recordKey一起重置
...
...
@@ -20,16 +24,15 @@ class Reporter {
}
// 设置参数内容
setData
(
dataObj
)
{
console
.
log
(
dataObj
);
// 设置系统名
this
.
system
=
dataObj
.
system
||
this
.
system
;
// 设置配置内容
this
.
config
=
dataObj
.
config
||
this
.
config
;
this
.
setEnvironment
(
this
.
config
.
env
);
// 设置用户标示
this
.
userIdentifier
=
dataObj
.
userInfo
||
this
.
userIdentifier
;
// 设置当前访问路径
this
.
path
=
dataObj
.
url
||
this
.
path
;
// 设置基础信息 系统名 + 用户标示 + 当前访问路径
dataObj
.
config
&&
delete
dataObj
.
config
this
.
baseInfo
=
{
...
this
.
baseInfo
,
...
dataObj
}
}
// 设置系统环境变量
...
...
src/lib/tracks.worker.js
View file @
b30763b3
...
...
@@ -7,8 +7,8 @@ const reporter = new Reporter("recordKey");
onmessage
=
({
data
:
{
type
,
payload
}
})
=>
{
switch
(
type
)
{
case
"init"
:
log
(
reporter
.
config
.
log
,
'init参数'
,
payload
);
reporter
.
setData
(
payload
);
log
(
reporter
.
config
.
log
,
'init参数'
,
payload
);
break
;
case
"record"
:
// todo : 数据本地存储
...
...
@@ -31,11 +31,11 @@ onmessage = ({ data: { type, payload } }) => {
break
;
case
"reset"
:
// todo : 重置参数,重新生成recordKey
const
{
url
,
email
,
userInfo
}
=
payload
;
reporter
.
setData
(
payload
);
let
recordKey
=
md5
(
url
+
email
+
Date
.
parse
(
new
Date
()));
const
{
path
,
email
}
=
payload
;
reporter
.
setData
(
{
path
}
);
let
recordKey
=
md5
(
path
+
email
+
Date
.
parse
(
new
Date
()));
reporter
.
reset
(
recordKey
);
log
(
reporter
.
config
.
log
,
'
用户信息'
,
userInfo
);
log
(
reporter
.
config
.
log
,
'
path'
,
reporter
.
baseInfo
.
path
);
log
(
reporter
.
config
.
log
,
'分片id'
,
reporter
.
recordKey
);
break
;
default
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment