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
0f2e7347
Commit
0f2e7347
authored
Apr 15, 2020
by
lauraMon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced debounce and throttle
parent
3006fcb9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
app/assets/javascripts/contextual_sidebar.js
app/assets/javascripts/contextual_sidebar.js
+2
-2
app/assets/javascripts/create_merge_request_dropdown.js
app/assets/javascripts/create_merge_request_dropdown.js
+2
-2
app/assets/javascripts/filterable_list.js
app/assets/javascripts/filterable_list.js
+2
-2
app/assets/javascripts/lazy_loader.js
app/assets/javascripts/lazy_loader.js
+4
-4
No files found.
app/assets/javascripts/contextual_sidebar.js
View file @
0f2e7347
import
$
from
'
jquery
'
;
import
{
debounce
}
from
'
lodash
'
;
import
Cookies
from
'
js-cookie
'
;
import
_
from
'
underscore
'
;
import
{
GlBreakpointInstance
as
bp
,
breakpoints
}
from
'
@gitlab/ui/dist/utils
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
...
...
@@ -43,7 +43,7 @@ export default class ContextualSidebar {
$
(
document
).
trigger
(
'
content.resize
'
);
});
$
(
window
).
on
(
'
resize
'
,
()
=>
_
.
debounce
(
this
.
render
(),
100
));
$
(
window
).
on
(
'
resize
'
,
debounce
(()
=>
this
.
render
(),
100
));
}
// See documentation: https://design.gitlab.com/regions/navigation#contextual-navigation
...
...
app/assets/javascripts/create_merge_request_dropdown.js
View file @
0f2e7347
/* eslint-disable no-new */
import
_
from
'
underscore
'
;
import
{
debounce
}
from
'
lodash
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
Flash
from
'
./flash
'
;
import
DropLab
from
'
./droplab/drop_lab
'
;
...
...
@@ -55,7 +55,7 @@ export default class CreateMergeRequestDropdown {
this
.
isCreatingMergeRequest
=
false
;
this
.
isGettingRef
=
false
;
this
.
mergeRequestCreated
=
false
;
this
.
refDebounce
=
_
.
debounce
((
value
,
target
)
=>
this
.
getRef
(
value
,
target
),
500
);
this
.
refDebounce
=
debounce
((
value
,
target
)
=>
this
.
getRef
(
value
,
target
),
500
);
this
.
refIsValid
=
true
;
this
.
refsPath
=
this
.
wrapperEl
.
dataset
.
refsPath
;
this
.
suggestedRef
=
this
.
refInput
.
value
;
...
...
app/assets/javascripts/filterable_list.js
View file @
0f2e7347
import
$
from
'
jquery
'
;
import
_
from
'
underscore
'
;
import
{
debounce
}
from
'
lodash
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
/**
...
...
@@ -29,7 +29,7 @@ export default class FilterableList {
initSearch
()
{
// Wrap to prevent passing event arguments to .filterResults;
this
.
debounceFilter
=
_
.
debounce
(
this
.
onFilterInput
.
bind
(
this
),
500
);
this
.
debounceFilter
=
debounce
(
this
.
onFilterInput
.
bind
(
this
),
500
);
this
.
unbindEvents
();
this
.
bindEvents
();
...
...
app/assets/javascripts/lazy_loader.js
View file @
0f2e7347
import
_
from
'
underscore
'
;
import
{
debounce
,
throttle
}
from
'
lodash
'
;
export
const
placeholderImage
=
'
data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
'
;
...
...
@@ -82,7 +82,7 @@ export default class LazyLoader {
}
startIntersectionObserver
=
()
=>
{
this
.
throttledElementsInView
=
_
.
throttle
(()
=>
this
.
checkElementsInView
(),
300
);
this
.
throttledElementsInView
=
throttle
(()
=>
this
.
checkElementsInView
(),
300
);
this
.
intersectionObserver
=
new
IntersectionObserver
(
this
.
onIntersection
,
{
rootMargin
:
`
${
SCROLL_THRESHOLD
}
px 0px`
,
thresholds
:
0.1
,
...
...
@@ -102,8 +102,8 @@ export default class LazyLoader {
};
startLegacyObserver
()
{
this
.
throttledScrollCheck
=
_
.
throttle
(()
=>
this
.
scrollCheck
(),
300
);
this
.
debouncedElementsInView
=
_
.
debounce
(()
=>
this
.
checkElementsInView
(),
300
);
this
.
throttledScrollCheck
=
throttle
(()
=>
this
.
scrollCheck
(),
300
);
this
.
debouncedElementsInView
=
debounce
(()
=>
this
.
checkElementsInView
(),
300
);
window
.
addEventListener
(
'
scroll
'
,
this
.
throttledScrollCheck
);
window
.
addEventListener
(
'
resize
'
,
this
.
debouncedElementsInView
);
}
...
...
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