Use requestAnimationFrame instead of setTimeout
For better performance.
This commit is contained in:
parent
acf3329ac2
commit
2d6d4df1f1
@ -137,7 +137,7 @@
|
||||
this.$content = this.$el.find('.chat-content');
|
||||
this.renderToolbar().renderAvatar();
|
||||
converse.emit('chatBoxOpened', this);
|
||||
window.setTimeout(utils.refreshWebkit, 50);
|
||||
utils.refreshWebkit();
|
||||
return this.showStatusMessage();
|
||||
},
|
||||
|
||||
|
@ -110,7 +110,7 @@
|
||||
}
|
||||
this.$content = this.$el.find('.chat-content');
|
||||
converse.emit('chatBoxOpened', this);
|
||||
window.setTimeout(utils.refreshWebkit, 50);
|
||||
utils.refreshWebkit();
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
@ -4,7 +4,7 @@
|
||||
// Copyright (c) 2012-2016, Jan-Carel Brand <jc@opkode.com>
|
||||
// Licensed under the Mozilla Public License (MPLv2)
|
||||
//
|
||||
/*global Backbone, define, window */
|
||||
/*global Backbone, define */
|
||||
|
||||
/* This is a Converse.js plugin which add support for multi-user chat rooms, as
|
||||
* specified in XEP-0045 Multi-user chat.
|
||||
@ -284,7 +284,7 @@
|
||||
info_configure: __('Configure this room'),
|
||||
})));
|
||||
this.renderChatArea();
|
||||
window.setTimeout(converse.refreshWebkit, 50);
|
||||
utils.refreshWebkit();
|
||||
return this;
|
||||
},
|
||||
|
||||
|
@ -237,11 +237,13 @@
|
||||
/* This works around a webkit bug. Refreshes the browser's viewport,
|
||||
* otherwise chatboxes are not moved along when one is closed.
|
||||
*/
|
||||
if ($.browser.webkit) {
|
||||
if ($.browser.webkit && window.requestAnimationFrame) {
|
||||
window.requestAnimationFrame(function () {
|
||||
var conversejs = document.getElementById('conversejs');
|
||||
conversejs.style.display = 'none';
|
||||
var tmp = conversejs.offsetHeight; // jshint ignore:line
|
||||
conversejs.style.display = 'block';
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user