perf(chatScroll): Improve performance of the commonly used js libraries
Adding .pragma library to the js libraries because the entry point on these libraries were called multiple times. There is no need to share the qml context with these libraries. Use find() instead of forEach() on emoji array to find an item
This commit is contained in:
parent
7adcbebb53
commit
15fe97c90c
|
@ -82,10 +82,9 @@ QtObject {
|
||||||
return value.match(/<img class=\"emoji\" draggable=\"false\" alt=\"(.+?)\" src=\".+?\/StatusQ\/src\/assets\/twemoji\/.+?" width=\"[0-9]*\" height=\"[0-9]*\" style=\"(.+?)\" ?\/>/g, "$1");
|
return value.match(/<img class=\"emoji\" draggable=\"false\" alt=\"(.+?)\" src=\".+?\/StatusQ\/src\/assets\/twemoji\/.+?" width=\"[0-9]*\" height=\"[0-9]*\" style=\"(.+?)\" ?\/>/g, "$1");
|
||||||
}
|
}
|
||||||
function getEmojiUnicode(shortname) {
|
function getEmojiUnicode(shortname) {
|
||||||
var _emoji;
|
|
||||||
EmojiJSON.emoji_json.forEach(function(emoji) {
|
const _emoji = EmojiJSON.emoji_json.find(function(emoji) {
|
||||||
if (emoji.shortname === shortname)
|
return (emoji.shortname === shortname)
|
||||||
_emoji = emoji;
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if (_emoji !== undefined)
|
if (_emoji !== undefined)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
.pragma library
|
||||||
|
|
||||||
var emojiCategories = [
|
var emojiCategories = [
|
||||||
"time",
|
"time",
|
||||||
"smileys-and-people",
|
"smileys-and-people",
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* Most this code was copied from https://github.com/leizongmin/js-xss and slightly modifed
|
* Most this code was copied from https://github.com/leizongmin/js-xss and slightly modifed
|
||||||
* to work with JavaScript resource loading in QML.
|
* to work with JavaScript resource loading in QML.
|
||||||
*/
|
*/
|
||||||
|
.pragma library
|
||||||
|
|
||||||
var defaultCSSFilter = new FilterCSS();
|
var defaultCSSFilter = new FilterCSS();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue