Avoid O(N^2) loop when loading channel emotes on channel load

This commit is contained in:
Calvin Montgomery 2018-03-05 21:35:56 -08:00
parent 726a5bf7c4
commit 247cf770d0
2 changed files with 2 additions and 4 deletions

View File

@ -2,7 +2,7 @@
"author": "Calvin Montgomery", "author": "Calvin Montgomery",
"name": "CyTube", "name": "CyTube",
"description": "Online media synchronizer and chat", "description": "Online media synchronizer and chat",
"version": "3.55.0", "version": "3.55.1",
"repository": { "repository": {
"url": "http://github.com/calzoneman/sync" "url": "http://github.com/calzoneman/sync"
}, },

View File

@ -126,9 +126,7 @@ EmoteModule.prototype = Object.create(ChannelModule.prototype);
EmoteModule.prototype.load = function (data) { EmoteModule.prototype.load = function (data) {
if ("emotes" in data) { if ("emotes" in data) {
for (var i = 0; i < data.emotes.length; i++) { this.emotes = new EmoteList(data.emotes);
this.emotes.updateEmote(data.emotes[i]);
}
} }
this.dirty = false; this.dirty = false;