Commit 2d6d4df1 authored by JC Brand's avatar JC Brand

Use requestAnimationFrame instead of setTimeout

For better performance.
parent acf3329a
......@@ -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) {
var conversejs = document.getElementById('conversejs');
conversejs.style.display = 'none';
var tmp = conversejs.offsetHeight; // jshint ignore:line
conversejs.style.display = 'block';
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';
});
}
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment