Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a2cd41be
Commit
a2cd41be
authored
Sep 24, 2020
by
Denys Mishunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved performance types to constants
parent
4ca4e079
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
app/assets/javascripts/performance_bar/performance_bar_log.js
...assets/javascripts/performance_bar/performance_bar_log.js
+6
-5
app/assets/javascripts/performance_constants.js
app/assets/javascripts/performance_constants.js
+3
-0
No files found.
app/assets/javascripts/performance_bar/performance_bar_log.js
View file @
a2cd41be
/* eslint-disable no-console */
/* eslint-disable no-console */
import
{
getCLS
,
getFID
,
getLCP
}
from
'
web-vitals
'
;
import
{
getCLS
,
getFID
,
getLCP
}
from
'
web-vitals
'
;
import
{
PERFORMANCE_TYPE_MARK
,
PERFORMANCE_TYPE_MEASURE
}
from
'
~/performance_constants
'
;
const
initVitalsLog
=
()
=>
{
const
initVitalsLog
=
()
=>
{
const
reportVital
=
data
=>
{
const
reportVital
=
data
=>
{
...
@@ -22,13 +23,13 @@ const logUserTimingMetrics = () => {
...
@@ -22,13 +23,13 @@ const logUserTimingMetrics = () => {
entries
.
forEach
(
entry
=>
{
entries
.
forEach
(
entry
=>
{
const
{
name
,
entryType
,
startTime
,
duration
}
=
entry
;
const
{
name
,
entryType
,
startTime
,
duration
}
=
entry
;
const
typeMapper
=
{
const
typeMapper
=
{
mark
:
String
.
fromCodePoint
(
0x1f3af
),
PERFORMANCE_MARK
:
String
.
fromCodePoint
(
0x1f3af
),
measure
:
String
.
fromCodePoint
(
0x1f4d0
),
PERFORMANCE_MEASURE
:
String
.
fromCodePoint
(
0x1f4d0
),
};
};
console
.
group
(
`
${
typeMapper
[
entryType
]}
${
name
}
`
);
console
.
group
(
`
${
typeMapper
[
entryType
]}
${
name
}
`
);
if
(
entryType
===
'
mark
'
)
{
if
(
entryType
===
PERFORMANCE_TYPE_MARK
)
{
console
.
log
(
`Start time:
${
startTime
}
`
);
console
.
log
(
`Start time:
${
startTime
}
`
);
}
else
if
(
entryType
===
'
measure
'
)
{
}
else
if
(
entryType
===
PERFORMANCE_TYPE_MEASURE
)
{
console
.
log
(
`Duration:
${
duration
}
`
);
console
.
log
(
`Duration:
${
duration
}
`
);
}
}
console
.
log
(
entry
);
console
.
log
(
entry
);
...
@@ -36,7 +37,7 @@ const logUserTimingMetrics = () => {
...
@@ -36,7 +37,7 @@ const logUserTimingMetrics = () => {
});
});
};
};
const
observer
=
new
PerformanceObserver
(
metricsProcessor
);
const
observer
=
new
PerformanceObserver
(
metricsProcessor
);
observer
.
observe
({
entryTypes
:
[
'
mark
'
,
'
measure
'
]
});
observer
.
observe
({
entryTypes
:
[
PERFORMANCE_TYPE_MEASURE
,
PERFORMANCE_TYPE_MARK
]
});
};
};
const
initPerformanceBarLog
=
()
=>
{
const
initPerformanceBarLog
=
()
=>
{
...
...
app/assets/javascripts/performance_constants.js
View file @
a2cd41be
export
const
PERFORMANCE_TYPE_MARK
=
'
mark
'
;
export
const
PERFORMANCE_TYPE_MEASURE
=
'
measure
'
;
//
//
// SNIPPET namespace
// SNIPPET namespace
//
//
...
...
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