mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-03-28 04:35:17 +00:00
20 lines
756 B
TypeScript
20 lines
756 B
TypeScript
import { AbstractModule } from "../AbstractModule";
|
|
import type { ICoreModule } from "../ModuleTypes";
|
|
import { PouchDB } from "../../lib/src/pouchdb/pouchdb-browser";
|
|
|
|
export class ModulePouchDB extends AbstractModule implements ICoreModule {
|
|
$$createPouchDBInstance<T extends object>(
|
|
name?: string,
|
|
options?: PouchDB.Configuration.DatabaseConfiguration
|
|
): PouchDB.Database<T> {
|
|
const optionPass = options ?? {};
|
|
if (this.settings.useIndexedDBAdapter) {
|
|
optionPass.adapter = "indexeddb";
|
|
//@ts-ignore :missing def
|
|
optionPass.purged_infos_limit = 1;
|
|
return new PouchDB(name + "-indexeddb", optionPass);
|
|
}
|
|
return new PouchDB(name, optionPass);
|
|
}
|
|
}
|