FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
frontend/static/src/javascripts/boot.js at master · devhttps/frontend · GitHub
devhttps
/
frontend
Public
forked from
guardian/frontend
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
frontend
/
static
/
src
/
javascripts
/
boot.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
85 lines (75 loc) · 2.97 KB
Breadcrumbs
frontend
/
static
/
src
/
javascripts
/
boot.js
Copy path
File metadata and controls
85 lines (75 loc) · 2.97 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//
@flow
// es7 polyfills not provided by pollyfill.io
import
'core-js/modules/es7.object.get-own-property-descriptors'
;
import
domready
from
'domready'
;
import
raven
from
'lib/raven'
;
import
{
bootStandard
}
from
'bootstraps/standard/main'
;
import
config
from
'lib/config'
;
import
{
markTime
}
from
'lib/user-timing'
;
import
{
capturePerfTimings
}
from
'lib/capture-perf-timings'
;
// Let webpack know where to get files from
// __webpack_public_path__ is a special webpack variable
// https://webpack.js.org/guides/public-path/#set-value-on-the-fly
// eslint-disable-next-line camelcase,no-undef
__webpack_public_path__
=
`
${
config
.
get
(
'page.assetsPath'
)
}
javascripts/`
;
// kick off the app
const
go
=
(
)
=>
{
domready
(
(
)
=>
{
// 1. boot standard, always
markTime
(
'standard boot'
)
;
bootStandard
(
)
;
// 2. once standard is done, next is commercial
if
(
process
.
env
.
NODE_ENV
!==
'production'
)
{
window
.
guardian
.
adBlockers
.
onDetect
.
push
(
isInUse
=>
{
const
needsMessage
=
isInUse
&&
window
.
console
&&
window
.
console
.
warn
;
const
message
=
'Do you have an adblocker enabled? Commercial features might fail to run, or throw exceptions.'
;
if
(
needsMessage
)
{
window
.
console
.
warn
(
message
)
;
}
}
)
;
}
// Start downloading these ASAP
// eslint-disable-next-line no-nested-ternary
const
fetchCommercial
=
config
.
get
(
'switches.commercial'
)
?
(
markTime
(
'commercial request'
)
,
import
(
/* webpackChunkName: "commercial" */
'bootstraps/commercial'
)
)
:
Promise
.
resolve
(
{
bootCommercial
:
(
)
=>
{
}
}
)
;
const
fetchEnhanced
=
window
.
guardian
.
isEnhanced
?
(
markTime
(
'enhanced request'
)
,
import
(
/* webpackChunkName: "enhanced" */
'bootstraps/enhanced/main'
)
)
:
Promise
.
resolve
(
{
bootEnhanced
:
(
)
=>
{
}
}
)
;
raven
.
context
(
{
tags
:
{
feature
:
'commercial'
,
}
,
}
,
(
)
=>
{
Promise
.
all
(
[
fetchCommercial
.
then
(
(
{
bootCommercial
}
)
=>
{
markTime
(
'commercial boot'
)
;
return
bootCommercial
(
)
;
}
)
,
fetchEnhanced
.
then
(
(
{
bootEnhanced
}
)
=>
{
markTime
(
'enhanced boot'
)
;
return
bootEnhanced
(
)
;
}
)
,
]
)
.
then
(
(
)
=>
{
if
(
document
.
readyState
===
'complete'
)
{
capturePerfTimings
(
)
;
}
else
{
window
.
addEventListener
(
'load'
,
capturePerfTimings
)
;
}
}
)
;
}
)
;
}
)
;
}
;
// make sure we've patched the env before running the app
if
(
window
.
guardian
.
polyfilled
)
{
go
(
)
;
}
else
{
window
.
guardian
.
onPolyfilled
=
go
;
}
Back
|
FazBrowse Home
|
New Git URL