Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't synchronously invoke the callbacks: wait, just as if the event …

…were delayed by the network
  • Loading branch information...
commit 7b93e5edfb78fd05e12fab0d50ddc006d1c14868 1 parent 7a3ad6a
Tony Garnock-Jones authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 test/server_root/htdocs/jsonrpc.js
12 test/server_root/htdocs/jsonrpc.js
View
@@ -70,8 +70,10 @@ Object.extend(JsonRpcTransaction.prototype,
addCallback: function(cb) {
this.callbacks.push(cb);
if (this.replyReady) {
- try { cb(this.reply, false); }
- catch (err) {}
+ setTimeout(function () {
+ try { cb(this.reply, false); }
+ catch (err) {}
+ }, 0);
}
return this;
},
@@ -79,8 +81,10 @@ Object.extend(JsonRpcTransaction.prototype,
addErrorCallback: function(cb) {
this.errorCallbacks.push(cb);
if (this.error) {
- try { cb(this.error, true); }
- catch (err) {}
+ setTimeout(function () {
+ try { cb(this.error, true); }
+ catch (err) {}
+ }, 0);
}
return this;
}
Please sign in to comment.
Something went wrong with that request. Please try again.