| 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; |