blob: 12d710eada1cbe03e8ec6ca4d2dc6be660a3b5dc [file] [log] [blame]
import { replicate } from './replicateWrapper';
import sync from './sync';
function replication(PouchDB) {
PouchDB.replicate = replicate;
PouchDB.sync = sync;
Object.defineProperty(PouchDB.prototype, 'replicate', {
get: function () {
var self = this;
if (typeof this.replicateMethods === 'undefined') {
this.replicateMethods = {
from: function (other, opts, callback) {
return self.constructor.replicate(other, self, opts, callback);
},
to: function (other, opts, callback) {
return self.constructor.replicate(self, other, opts, callback);
}
};
}
return this.replicateMethods;
}
});
PouchDB.prototype.sync = function (dbName, opts, callback) {
return this.constructor.sync(this, dbName, opts, callback);
};
}
export default replication;