MCPcopy Index your code
hub / github.com/apache/pouchdb / constructor

Method constructor

lib/index-browser.js:10366–10548  ·  view source on GitHub ↗
(src, target, opts, callback)

Source from the content-addressed store, hash-verified

10364
10365class Sync extends EE {
10366 constructor(src, target, opts, callback) {
10367 super();
10368 this.canceled = false;
10369
10370 const optsPush = opts.push ? Object.assign({}, opts, opts.push) : opts;
10371 const optsPull = opts.pull ? Object.assign({}, opts, opts.pull) : opts;
10372
10373 this.push = replicateWrapper(src, target, optsPush);
10374 this.pull = replicateWrapper(target, src, optsPull);
10375
10376 this.pushPaused = true;
10377 this.pullPaused = true;
10378
10379 const pullChange = (change) => {
10380 this.emit('change', {
10381 direction: 'pull',
10382 change
10383 });
10384 };
10385 const pushChange = (change) => {
10386 this.emit('change', {
10387 direction: 'push',
10388 change
10389 });
10390 };
10391 const pushDenied = (doc) => {
10392 this.emit('denied', {
10393 direction: 'push',
10394 doc
10395 });
10396 };
10397 const pullDenied = (doc) => {
10398 this.emit('denied', {
10399 direction: 'pull',
10400 doc
10401 });
10402 };
10403 const pushPaused = () => {
10404 this.pushPaused = true;
10405 /* istanbul ignore if */
10406 if (this.pullPaused) {
10407 this.emit('paused');
10408 }
10409 };
10410 const pullPaused = () => {
10411 this.pullPaused = true;
10412 /* istanbul ignore if */
10413 if (this.pushPaused) {
10414 this.emit('paused');
10415 }
10416 };
10417 const pushActive = () => {
10418 this.pushPaused = false;
10419 /* istanbul ignore if */
10420 if (this.pullPaused) {
10421 this.emit('active', {
10422 direction: 'push'
10423 });

Callers

nothing calls this directly

Calls 3

cancelMethod · 0.95
replicateWrapperFunction · 0.70
removeListenerMethod · 0.45

Tested by

no test coverage detected