Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
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
0
Merge Requests
0
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
converse.js
Commits
099603ed
Commit
099603ed
authored
Dec 02, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chatview: Reduce debounce time for markScrolled from 100ms to 50ms
parent
fc42f290
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
src/converse-chatview.js
src/converse-chatview.js
+13
-10
No files found.
src/converse-chatview.js
View file @
099603ed
...
@@ -272,7 +272,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -272,7 +272,7 @@ converse.plugins.add('converse-chatview', {
},
},
initDebounced
()
{
initDebounced
()
{
this
.
scrollDown
=
debounce
(
this
.
_scrollDown
,
10
0
);
this
.
scrollDown
=
debounce
(
this
.
_scrollDown
,
5
0
);
this
.
markScrolled
=
debounce
(
this
.
_markScrolled
,
100
);
this
.
markScrolled
=
debounce
(
this
.
_markScrolled
,
100
);
},
},
...
@@ -433,7 +433,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -433,7 +433,7 @@ converse.plugins.add('converse-chatview', {
await
Promise
.
all
(
this
.
model
.
messages
.
map
(
m
=>
this
.
onMessageAdded
(
m
)));
await
Promise
.
all
(
this
.
model
.
messages
.
map
(
m
=>
this
.
onMessageAdded
(
m
)));
this
.
insertIntoDOM
();
this
.
insertIntoDOM
();
this
.
scrollDown
();
this
.
scrollDown
();
this
.
content
.
addEventListener
(
'
scroll
'
,
this
.
markScrolled
.
bind
(
this
));
this
.
content
.
addEventListener
(
'
scroll
'
,
()
=>
this
.
markScrolled
(
));
/**
/**
* Triggered whenever a `_converse.ChatBox` instance has fetched its messages from
* Triggered whenever a `_converse.ChatBox` instance has fetched its messages from
* `sessionStorage` but **NOT** from the server.
* `sessionStorage` but **NOT** from the server.
...
@@ -1261,14 +1261,17 @@ converse.plugins.add('converse-chatview', {
...
@@ -1261,14 +1261,17 @@ converse.plugins.add('converse-chatview', {
}
}
},
},
_markScrolled
:
function
(
ev
)
{
/**
/* Called when the chat content is scrolled up or down.
* Called when the chat content is scrolled up or down.
* We want to record when the user has scrolled away from
* We want to record when the user has scrolled away from
* the bottom, so that we don't automatically scroll away
* the bottom, so that we don't automatically scroll away
* from what the user is reading when new messages are
* from what the user is reading when new messages are received.
* received.
*
*/
* Don't call this method directly, instead, call `markScrolled`,
if
(
ev
&&
ev
.
preventDefault
)
{
ev
.
preventDefault
();
}
* which debounces this method by 100ms.
* @private
*/
_markScrolled
:
function
()
{
let
scrolled
=
true
;
let
scrolled
=
true
;
const
is_at_bottom
=
const
is_at_bottom
=
(
this
.
content
.
scrollTop
+
this
.
content
.
clientHeight
)
>=
(
this
.
content
.
scrollTop
+
this
.
content
.
clientHeight
)
>=
...
...
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