Skip to content

Commit

Permalink
(#4121) - Remove utils.call
Browse files Browse the repository at this point in the history
  • Loading branch information
daleharvey committed Aug 4, 2015
1 parent 83d7e10 commit 5495181
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 21 deletions.
10 changes: 5 additions & 5 deletions lib/adapters/http/index.js
Expand Up @@ -941,7 +941,7 @@ function HttpPouch(opts, callback) {
// In case of an error, stop listening for changes and call
// opts.complete
opts.aborted = true;
utils.call(opts.complete, err);
opts.complete(err);
return;
}

Expand All @@ -967,15 +967,15 @@ function HttpPouch(opts, callback) {
var maximumWait = opts.maximumWait || 30000;

if (retryWait > maximumWait) {
utils.call(opts.complete, err || errors.error(errors.UNKNOWN_ERROR));
opts.complete(err || errors.error(errors.UNKNOWN_ERROR));
return;
}

// Queue a call to fetch again with the newest sequence number
setTimeout(function () { fetch(lastFetchedSeq, fetched); }, retryWait);
} else {
// We're done, call the callback
utils.call(opts.complete, null, results);
opts.complete(null, results);
}
};

Expand Down Expand Up @@ -1028,7 +1028,7 @@ function HttpPouch(opts, callback) {
results.results.push(data);
}
results.last_seq = data.seq;
utils.call(opts.onChange, data);
opts.onChange(data);
}
function errHandler(err) {
source.removeEventListener('message', msgHandler, false);
Expand All @@ -1040,7 +1040,7 @@ function HttpPouch(opts, callback) {
return;
}
source.close();
utils.call(opts.complete, err);
opts.complete(err);
}

};
Expand Down
2 changes: 1 addition & 1 deletion lib/adapters/idb/index.js
Expand Up @@ -642,7 +642,7 @@ function init(api, opts, callback) {
};
txn.onerror = idbError(callback);
txn.oncomplete = function () {
utils.call(callback);
callback();
};
};

Expand Down
5 changes: 2 additions & 3 deletions lib/changesHandler.js
Expand Up @@ -5,7 +5,6 @@ var inherits = require('inherits');
var isChromeApp = require('./deps/env/isChromeApp');
var hasLocalStorage = require('./deps/env/hasLocalStorage');
var pick = require('./deps/pick');
var call = require('./deps/call');

inherits(Changes, EventEmitter);

Expand Down Expand Up @@ -61,7 +60,7 @@ Changes.prototype.addListener = function (dbName, id, db, opts) {
db.changes(changesOpts).on('change', function (c) {
if (c.seq > opts.since && !opts.cancelled) {
opts.since = c.seq;
call(opts.onChange, c);
opts.onChange(c);
}
}).on('complete', function () {
if (inprogress === 'waiting') {
Expand Down Expand Up @@ -103,4 +102,4 @@ Changes.prototype.notify = function (dbName) {
this.notifyLocalWindows(dbName);
};

module.exports = Changes;
module.exports = Changes;
10 changes: 0 additions & 10 deletions lib/deps/call.js

This file was deleted.

3 changes: 1 addition & 2 deletions lib/utils.js
Expand Up @@ -30,7 +30,6 @@ exports.clone = function (obj) {

exports.pick = require('./deps/pick');
exports.inherits = require('inherits');
exports.call = require('./deps/call');

exports.filterChange = function filterChange(opts) {
var req = {};
Expand Down Expand Up @@ -161,4 +160,4 @@ exports.safeJsonStringify = function safeJsonStringify(json) {
} catch (e) {
return vuvuzela.stringify(json);
}
};
};

0 comments on commit 5495181

Please sign in to comment.