Mercurial > urweb
comparison lib/js/urweb.js @ 824:be0988e46336
Use a timeout to avoid errors after unload
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 28 May 2009 11:45:45 -0400 |
parents | 395a5d450cc0 |
children | 14a6c0971d89 |
comparison
equal
deleted
inserted
replaced
823:669ac5e9a69e | 824:be0988e46336 |
---|---|
92 function onServerError(f) { | 92 function onServerError(f) { |
93 serverHandlers = cons(f, serverHandlers); | 93 serverHandlers = cons(f, serverHandlers); |
94 } | 94 } |
95 | 95 |
96 function servErr(s) { | 96 function servErr(s) { |
97 runHandlers("Server", serverHandlers, s); | 97 window.setTimeout(function () { runHandlers("Server", serverHandlers, s); }, 0); |
98 } | 98 } |
99 | 99 |
100 | 100 |
101 // Embedding closures in XML strings | 101 // Embedding closures in XML strings |
102 | 102 |
548 | 548 |
549 connect(); | 549 connect(); |
550 } | 550 } |
551 else { | 551 else { |
552 try { | 552 try { |
553 servErr("Error querying remote server for messages: " + xhr.status); | 553 if (xhr.status != 0) |
554 servErr("Error querying remote server for messages: " + xhr.status); | |
554 } catch (e) { servErr("Error querying remote server for messages"); } | 555 } catch (e) { servErr("Error querying remote server for messages"); } |
555 } | 556 } |
556 } | 557 } |
557 }; | 558 }; |
558 | 559 |