cellsysBase/CellsysLocalLog.js

19 lines
504 B
JavaScript
Raw Normal View History

2024-08-14 16:20:56 +08:00
let databaseName = 'cellsys';
let version = 1;
let db;
let request = window.indexedDB.open(databaseName, version);
request.onerror = function (error) {
console.log('IndexDB打开失败', error);
};
request.onsuccess = function (res) {
console.log('IndexDB打开成功', res);
db = res.target.result;
};
function addLog() {
const transaction = db.transaction(['myObjectStore'], 'readwrite');
const objectStore = transaction.objectStore('myObjectStore');
objectStore.add(data);
}