Add:Start adding new nosql database plugin for android

This commit is contained in:
advplyr
2022-03-06 12:53:18 -06:00
parent f5088d0384
commit 6d8479ac7d
6 changed files with 102 additions and 4 deletions
+29
View File
@@ -0,0 +1,29 @@
import { registerPlugin } from '@capacitor/core';
const DbManager = registerPlugin('DbManager');
class DbService {
constructor() { }
save(db, key, value) {
return DbManager.saveFromWebview({ db, key, value }).then(() => {
console.log('Saved data', db, key, JSON.stringify(value))
}).catch((error) => {
console.error('Failed to save data', error)
})
}
load(db, key) {
return DbManager.loadFromWebview({ db, key }).then((data) => {
console.log('Loaded data', db, key, JSON.stringify(data))
return data
}).catch((error) => {
console.error('Failed to load', error)
return null
})
}
}
export default ({ app, store }, inject) => {
inject('db', new DbService())
}