Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
e9dbeb77
Commit
e9dbeb77
authored
6 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
ignore user timings for production build
parent
2eb1bfe4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mol-task/util/user-timing.ts
+10
-4
10 additions, 4 deletions
src/mol-task/util/user-timing.ts
webpack.config.js
+0
-2
0 additions, 2 deletions
webpack.config.js
with
10 additions
and
6 deletions
src/mol-task/util/user-timing.ts
+
10
−
4
View file @
e9dbeb77
/**
/**
* Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
* Copyright (c) 2018
-2019
mol* contributors, licensed under MIT, See LICENSE file for more info.
*
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
*/
...
@@ -7,17 +7,23 @@
...
@@ -7,17 +7,23 @@
import
{
Task
}
from
'
../task
'
import
{
Task
}
from
'
../task
'
const
hasPerformance
=
typeof
performance
!==
'
undefined
'
const
hasPerformance
=
typeof
performance
!==
'
undefined
'
/**
* on node `process.env.NODE_ENV` is available, in webpack build it is automatically set
* by the DefinePlugin to the webpack `mode` value
*/
const
productionMode
=
process
.
env
.
NODE_ENV
===
'
production
'
const
timingEnabled
=
hasPerformance
&&
!
productionMode
export
namespace
UserTiming
{
export
namespace
UserTiming
{
function
startMarkName
(
task
:
Task
<
any
>
)
{
return
`startTask
${
task
.
id
}
`
}
function
startMarkName
(
task
:
Task
<
any
>
)
{
return
`startTask
${
task
.
id
}
`
}
function
endMarkName
(
task
:
Task
<
any
>
)
{
return
`endTask
${
task
.
id
}
`
}
function
endMarkName
(
task
:
Task
<
any
>
)
{
return
`endTask
${
task
.
id
}
`
}
export
function
markStart
(
task
:
Task
<
any
>
)
{
export
function
markStart
(
task
:
Task
<
any
>
)
{
if
(
hasPerformance
)
performance
.
mark
(
startMarkName
(
task
))
if
(
timingEnabled
)
performance
.
mark
(
startMarkName
(
task
))
}
}
export
function
markEnd
(
task
:
Task
<
any
>
)
{
export
function
markEnd
(
task
:
Task
<
any
>
)
{
if
(
hasPerformance
)
performance
.
mark
(
endMarkName
(
task
))
if
(
timingEnabled
)
performance
.
mark
(
endMarkName
(
task
))
}
}
export
function
measure
(
task
:
Task
<
any
>
)
{
export
function
measure
(
task
:
Task
<
any
>
)
{
if
(
hasPerformance
)
performance
.
measure
(
task
.
name
,
startMarkName
(
task
),
endMarkName
(
task
))
if
(
timingEnabled
)
performance
.
measure
(
`✳️
${
task
.
name
}
`
,
startMarkName
(
task
),
endMarkName
(
task
))
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
webpack.config.js
+
0
−
2
View file @
e9dbeb77
...
@@ -49,8 +49,6 @@ const sharedConfig = {
...
@@ -49,8 +49,6 @@ const sharedConfig = {
}),
}),
new
webpack
.
DefinePlugin
({
new
webpack
.
DefinePlugin
({
__PLUGIN_VERSION_TIMESTAMP__
:
webpack
.
DefinePlugin
.
runtimeValue
(()
=>
`
${
new
Date
().
valueOf
()}
`
,
true
),
__PLUGIN_VERSION_TIMESTAMP__
:
webpack
.
DefinePlugin
.
runtimeValue
(()
=>
`
${
new
Date
().
valueOf
()}
`
,
true
),
// include this for production version of React
// 'process.env.NODE_ENV': JSON.stringify('production')
}),
}),
new
MiniCssExtractPlugin
({
filename
:
'
app.css
'
})
new
MiniCssExtractPlugin
({
filename
:
'
app.css
'
})
],
],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment