From 346f4b7b3c504da3c370045f72fb932489fa5578 Mon Sep 17 00:00:00 2001 From: Tj Holowaychuk Date: Tue, 7 Sep 2010 10:13:09 -0700 Subject: [PATCH] Fixed callback signatures --- examples/google.js | 2 +- examples/google.nested.js | 10 +++++----- lib/soda/client.js | 16 ++++++++-------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/google.js b/examples/google.js index ed98f47..ea14d5a 100644 --- a/examples/google.js +++ b/examples/google.js @@ -20,7 +20,7 @@ browser .clickAndWait('btnG') .assertTitle('Hello World - Google Search') .testComplete() - .done(function(err, res){ + .done(function(err, body, res){ if (err) throw err; console.log('done'); }); diff --git a/examples/google.nested.js b/examples/google.nested.js index ae42285..aa18797 100644 --- a/examples/google.nested.js +++ b/examples/google.nested.js @@ -13,12 +13,12 @@ var browser = soda.createClient({ }); browser.session(function(err){ - browser.open('/', function(err, res){ - browser.type('q', 'Hello World', function(err, res){ - browser.clickAndWait('btnG', function(err, res){ - browser.assertTitle('Hello World - Google Search', function(err, res){ + browser.open('/', function(err, body){ + browser.type('q', 'Hello World', function(err, body){ + browser.clickAndWait('btnG', function(err, body){ + browser.assertTitle('Hello World - Google Search', function(err, body){ if (err) throw err; - browser.testComplete(function(err, res){ + browser.testComplete(function(err, body){ console.log('done'); }); }); diff --git a/lib/soda/client.js b/lib/soda/client.js index a3241e7..7cf2fa5 100644 --- a/lib/soda/client.js +++ b/lib/soda/client.js @@ -47,13 +47,13 @@ Client.prototype.session = function(fn){ if (!this.browser) throw new Error('browser required'); if (!this.url) throw new Error('browser url required'); if (this.queue) { - return this.enqueue('getNewBrowserSession', [this.browser, this.url], function(err, res){ - self.sid = res.body; + return this.enqueue('getNewBrowserSession', [this.browser, this.url], function(err, body){ + self.sid = body; }); } else { - this.command('getNewBrowserSession', [this.browser, this.url], function(err, res){ + this.command('getNewBrowserSession', [this.browser, this.url], function(err, body){ if (err) return fn(err); - fn(null, self.sid = res.body); + fn(null, self.sid = body); }); } }; @@ -163,14 +163,14 @@ Client.prototype.done = function(fn){ Client.prototype.enqueue = function(cmd, args, fn){ var self = this; this.queue.push(function(){ - self.command(cmd, args, function(err, res){ - fn && fn(err, res); + self.command(cmd, args, function(err, body, res){ + fn && fn(err, body, res); if (err) { - self.done(err, res); + self.done(err, body, res); } else if (self.queue.length) { self.queue.shift()(); } else { - self.done(null, res); + self.done(null, body, res); } }); });