mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-08 21:08:43 +02:00
Add:Start adding new nosql database plugin for android
This commit is contained in:
@@ -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())
|
||||
}
|
||||
Reference in New Issue
Block a user