master
yutent 2023-05-29 11:13:47 +08:00
parent dcc9edf859
commit c66283c562
3 changed files with 32 additions and 39 deletions

View File

@ -4,7 +4,37 @@
* @date 2020/08/31 15:46:20
*/
import Method from './method.js'
class Method {
constructor(table) {
this.table = table
}
put(obj) {
this.table.put(obj)
}
get(id) {
var res = this.table.get(id)
return new Promise(resolve => {
res.onsuccess = function (ev) {
resolve(this.result)
}
})
}
getAll() {
var res = this.table.getAll()
return new Promise(resolve => {
res.onsuccess = function (ev) {
resolve(this.result)
}
})
}
delete(id) {
this.table.delete(id)
}
}
export default class Api {
constructor(db) {

View File

@ -4,7 +4,7 @@
* @date 2023/04/11 15:10:04
*/
import { defer, createTable } from './helper.js'
import { defer } from './helper.js'
import Api from './api.js'
export function createStore(name, version = 1) {

View File

@ -1,37 +0,0 @@
/**
* {}
* @author yutent<yutent.io@gmail.com>
* @date 2023/04/11 15:11:31
*/
export default class Method {
constructor(table) {
this.table = table
}
put(obj) {
this.table.put(obj)
}
get(id) {
var res = this.table.get(id)
return new Promise(resolve => {
res.onsuccess = function (ev) {
resolve(this.result)
}
})
}
getAll() {
var res = this.table.getAll()
return new Promise(resolve => {
res.onsuccess = function (ev) {
resolve(this.result)
}
})
}
delete(id) {
this.table.delete(id)
}
}