blob: 6c9834e72e9128e8faf7c54208984c7f0ac1cefd [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;
return {
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);
}
};
}
});
PouchDB.prototype.sync = function (dbName, opts, callback) {
return this.constructor.sync(this, dbName, opts, callback);
};
}
export default replication;