-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
improve index.d.ts #125
improve index.d.ts #125
Conversation
export PouchDB for check adapter can use. const db = new PouchDB('mydb', { adapter: adapter }); return db.info();
Hi @Jimmysh |
function checkAdapterWorks(adapterName: string) {
try {
const db = new PouchDB('testDB', { adapter: adapterName });
return !!db.info();
} catch (e) {
}
return false;
}
const adapters: {
name: string,
entity: any
}[] = [
{ name: 'idb', entity: idb },
{ name: 'websql', entity: websql },
{ name: 'localstorage', entity: localstorage },
{ name: 'memory', entity: memory },
];
const find = _.find(adapters, (adapter: any) => checkAdapterWorks(adapter.name));
if (find) {
this.useAdapter = find;
console.log('current adapter', this.useAdapter);
} else {
console.log('don't support');
} sample. EDIT by pubkey: formated code |
You defined the function Also your example does not explain why every creator-interface should be public. |
export DatabaseCreator for const creatorArr : creator[] = []; const promissArr = creatorArr.map( d => RxDB.create(d));
The last commit was added here by mistake. Just ignore it. |
export PouchDB for check adapter can use.
const db = new PouchDB('mydb', { adapter: adapter });
return db.info();