Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to integrate offline syncing in ionic 3 app? #88

Open
binita12345 opened this issue Jul 2, 2018 · 1 comment
Open

how to integrate offline syncing in ionic 3 app? #88

binita12345 opened this issue Jul 2, 2018 · 1 comment

Comments

@binita12345
Copy link

No description provided.

@paolosanchi
Copy link
Contributor

paolosanchi commented Jul 4, 2018

this should work:
https://www.joshmorony.com/offline-syncing-in-ionic-2-with-pouchdb-couchdb/

basically I did:

import PouchDB from 'pouchdb';
import PouchDBFind from 'pouchdb-find';
import PouchDBAdapterCordovaSqlite from 'pouchdb-adapter-cordova-sqlite';

...

constructor() {
	PouchDB.plugin(PouchDBFind);
	PouchDB.plugin(PouchDBAdapterCordovaSqlite);

	// debug or not
	PouchDB.debug.enable('pouchdb:find');
	// PouchDB.debug.enable('*');
}

then the usual initialization:

this.localDb = new PouchDB("dbname", {
	//  size: 50,
	auto_compaction: true,
	adapter: adapter,
	location: 'default',
} as any);

..

this.localDb.sync("remote connection string", {
	live: true,
	retry: true,
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants