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
b9a2a581
Commit
b9a2a581
authored
Oct 01, 2020
by
Denys Mishunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Load helpers async after Vue application
This reduces the number of the blocking JS resources on page load
parent
91fa8e8b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
6 deletions
+21
-6
app/assets/javascripts/snippet/snippet_show.js
app/assets/javascripts/snippet/snippet_show.js
+21
-6
No files found.
app/assets/javascripts/snippet/snippet_show.js
View file @
b9a2a581
import
initNotes
from
'
~/init_notes
'
;
import
loadAwardsHandler
from
'
~/awards_handler
'
;
if
(
!
gon
.
features
.
snippetsVue
)
{
const
LineHighlighterModule
=
import
(
'
~/line_highlighter
'
);
const
BlobViewerModule
=
import
(
'
~/blob/viewer
'
);
const
ZenModeModule
=
import
(
'
~/zen_mode
'
);
const
SnippetEmbedModule
=
import
(
'
~/snippet/snippet_embed
'
);
const
initNotesModule
=
import
(
'
~/init_notes
'
);
const
loadAwardsHandlerModule
=
import
(
'
~/awards_handler
'
);
Promise
.
all
([
LineHighlighterModule
,
BlobViewerModule
,
ZenModeModule
,
SnippetEmbedModule
])
Promise
.
all
([
LineHighlighterModule
,
BlobViewerModule
,
ZenModeModule
,
SnippetEmbedModule
,
initNotesModule
,
loadAwardsHandlerModule
,
])
.
then
(
([
{
default
:
LineHighlighter
},
{
default
:
BlobViewer
},
{
default
:
ZenMode
},
{
default
:
SnippetEmbed
},
{
default
:
initNotes
},
{
default
:
loadAwardsHandler
},
])
=>
{
new
LineHighlighter
();
// eslint-disable-line no-new
new
BlobViewer
();
// eslint-disable-line no-new
new
ZenMode
();
// eslint-disable-line no-new
SnippetEmbed
();
initNotes
();
loadAwardsHandler
();
},
)
.
catch
(()
=>
{});
...
...
@@ -27,7 +37,12 @@ if (!gon.features.snippetsVue) {
.
then
(({
SnippetShowInit
})
=>
{
SnippetShowInit
();
})
.
then
(()
=>
{
return
Promise
.
all
([
import
(
'
~/init_notes
'
),
import
(
'
~/awards_handler
'
)]);
})
.
then
(([{
default
:
initNotes
},
{
default
:
loadAwardsHandler
}])
=>
{
initNotes
();
loadAwardsHandler
();
})
.
catch
(()
=>
{});
}
initNotes
();
loadAwardsHandler
();
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