minor: Avoid dict lookup for color.

The only thing get_color() does is look
up a sub:

    exports.get_color = function (stream_name) {
        const sub = exports.get_sub(stream_name);
        if (sub === undefined) {
            return stream_color.default_color;
        }
        return sub.color;
    };

So if we have a sub already, there's no point
calling the helper.

Obviously, this isn't a huge deal, but it happens
N times during page load.
This commit is contained in:
Steve Howell 2019-12-27 20:52:21 +00:00 committed by Tim Abbott
parent 0711c7ea49
commit b3b83f223d
1 changed files with 1 additions and 1 deletions

View File

@ -216,7 +216,7 @@ function build_stream_sidebar_li(sub) {
is_muted: stream_data.is_muted(sub.stream_id) === true,
invite_only: sub.invite_only,
is_web_public: sub.is_web_public,
color: stream_data.get_color(name),
color: sub.color,
pin_to_top: sub.pin_to_top,
};
args.dark_background = stream_color.get_color_class(args.color);