Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 1 changed file with 8 additions and 4 deletions. Show diff stats Hide diff stats

  1. +8 4 test/server_root/htdocs/jsonrpc.js
12 test/server_root/htdocs/jsonrpc.js
@@ -70,8 +70,10 @@ Object.extend(JsonRpcTransaction.prototype,
70 70 addCallback: function(cb) {
71 71 this.callbacks.push(cb);
72 72 if (this.replyReady) {
73   - try { cb(this.reply, false); }
74   - catch (err) {}
  73 + setTimeout(function () {
  74 + try { cb(this.reply, false); }
  75 + catch (err) {}
  76 + }, 0);
75 77 }
76 78 return this;
77 79 },
@@ -79,8 +81,10 @@ Object.extend(JsonRpcTransaction.prototype,
79 81 addErrorCallback: function(cb) {
80 82 this.errorCallbacks.push(cb);
81 83 if (this.error) {
82   - try { cb(this.error, true); }
83   - catch (err) {}
  84 + setTimeout(function () {
  85 + try { cb(this.error, true); }
  86 + catch (err) {}
  87 + }, 0);
84 88 }
85 89 return this;
86 90 }

0 comments on commit 7b93e5e

Please sign in to comment.
Something went wrong with that request. Please try again.