yuenc-db
v2.0.1
Published
#### Description indexedDB helper
Downloads
5
Readme
indexed-db
介绍
indexedDB 简单封装
软件架构
indexedDB 简单封装
安装教程
npm i yuenc-db
使用说明
/**
* 打开数据库
*/
function connectDB() {
const conn = new DBConnectProCls('umb.guo-kai', {
keyval: {},
});
return conn;
}
export const conn = connectDB();
export const dbKeyval = {
async get<T = any>(key: string): Promise<T> {
const db = await conn.db;
const value = await db.get('keyval', key);
return value;
},
async set<T = any>(key: string, value: T) {
const db = await conn.db;
await db.set('keyval', value, key);
},
};