How to use the pouchdb-browser.sync function in pouchdb-browser

To help you get started, we’ve selected a few pouchdb-browser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github QurateInc / vue-pouch-db / src / index.js View on Github external
`${config.remote}/${dbname}`,
        config.options
      );
      return this._dbs[dbname];
    }

    // Init DB
    this._dbs[dbname] = new PouchDB(dbname, config.options);

    // Populate state with data
    this._dbs[dbname].allDocs(config.allDocs).then((data) => {
      return Vue.set(this._state, dbname, data.rows.map((row) => row.doc));
    });

    // Sync DB
    PouchDB.sync(
      dbname,
      `${config.remote}/${dbname}`,
      config.sync
    );

    // Start detecting changes
    this._initChanges(dbname, config);

    // Return instance
    return this._dbs[dbname];
  }
github QurateInc / vue-pouch-db / index.js View on Github external
var options = Object.assign({
        ajax: { cache: false }
      }, opts);

      if (opts.remoteOnly) {
        this$1.databases[dbname] = new PouchDB(
          ((config.remote) + "/" + dbname),
          options
        );
        return this$1.databases[dbname];
      }

      this$1.databases[dbname] = new PouchDB(dbname, options);

      PouchDB.sync(
        dbname,
        ((config.remote) + "/" + dbname),
        config.sync
      );

      return this$1.databases[dbname];
    };