Commit Graph

102 Commits

Author SHA1 Message Date
Steve Howell 8190cdc9fb Avoid redundant O(N) work in unfade_messages()..
The code in unfade_messages() is O(N) over the number of
messages, but a simple flag allows us to track the fact that
all messages are unfaded, so we can short circuit the O(N)
logic in many cases.

A typical scenario now would be that you start typing a
stream while the topic is still empty.  Modulo debouncing,
every keystroke now leads to a call to unfade_messages(),
but this change only does real work the first time.

(imported from commit da07cf408bbdbf5b381ff3ec33a5e05e34eef5b5)
2013-08-11 17:05:13 -04:00
Steve Howell 37f8cc9294 Extracted code into compose_fade.js.
The compose_fade has three public exports:

    set_focused_recipient
    unfade_messages
    update_faded_messages

All code was pulled directly from compose.js, except for the
one-line setter of set_focused_recipient.  The focused_recipients
variable that used to be in compose.js was moved to compose_fade.js,
hence the need for the setter.

(imported from commit 462ca5d0d0bd58612d0197f3734a8c78de8c6d30)
2013-08-11 17:05:13 -04:00