diff options
author | Jakub Narebski <jnareb@gmail.com> | 2011-05-27 15:50:01 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-05-27 11:00:42 -0700 |
commit | 42ab5d40deb6dff37705ce5aa16ac69d859a04e1 (patch) | |
tree | d5a7b49dc3bf58a87d185d9b74478e61cfdb8e7b /t/t9601 | |
parent | gitweb.js: No need for loop in blame_incremental's handleResponse() (diff) | |
download | tgif-42ab5d40deb6dff37705ce5aa16ac69d859a04e1.tar.xz |
gitweb.js: use setTimeout rather than setInterval in blame_incremental.js
If there is a possibility that your logic could take longer to execute
than the interval time, it is recommended that you recursively call a
named function using window.setTimeout rather than window.setInterval.
Therefore instead of using setInterval as an alternate way of invoking
handleResponse (because some web browsers call onreadystatechange only
once per each distinct state, and not for each server flush), use
setTimeout and reset it from handleResponse. As a bonus this allows
us to get rid of timer if it turns out that web browser calls
onreadystatechange on each server flush.
While at it get rid of `xhr' global variable, creating it instead as
local variable in startBlame and passing it as parameter, and of
`pollTimer' global variable, passing it as member of xhr object
(xhr.pollTimer).
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9601')
0 files changed, 0 insertions, 0 deletions