DEBUGL
This commit is contained in:
parent
e5c9623092
commit
c37086cfcd
@ -22,6 +22,7 @@
|
||||
"dependencies": {
|
||||
"express": "^4.18.2",
|
||||
"express-ws": "^5.0.2",
|
||||
"node-turn": "^0.0.6"
|
||||
"node-turn": "^0.0.6",
|
||||
"uuid": "^9.0.1"
|
||||
}
|
||||
}
|
||||
|
1
src/communication.js
Normal file
1
src/communication.js
Normal file
@ -0,0 +1 @@
|
||||
// 通信
|
@ -17,7 +17,7 @@ export default class IndexedDB {
|
||||
}
|
||||
request.onupgradeneeded = (event) => {
|
||||
const db = event.target.result
|
||||
if (!db.objectStoreNames.contains('todo')) {
|
||||
if (!db.objectStoreNames.contains(name)) {
|
||||
db.createObjectStore(name, { keyPath: 'id' })
|
||||
console.log('store created:', name)
|
||||
}
|
||||
|
@ -18,10 +18,6 @@ function appendBuffer(buffer1, buffer2) {
|
||||
return tmp.buffer
|
||||
}
|
||||
|
||||
//// 读取本地图像
|
||||
//const imageStore = new IndexedDB('musicDatabase', 1, 'imageObjectStore')
|
||||
//await imageStore.open()
|
||||
|
||||
// 读取本地音乐列表并标识为缓存状态(本地缓存)
|
||||
const database = new IndexedDB('musicDatabase', 1)
|
||||
await database.store('musicObjectStore') // 音乐(为什么会用这么丑的格式呢)
|
||||
|
45
src/store.js
Normal file
45
src/store.js
Normal file
@ -0,0 +1,45 @@
|
||||
import { v4 } from 'uuid'
|
||||
|
||||
export class Store {
|
||||
constructor(data) {
|
||||
this.name = data.name
|
||||
this.info = data.info
|
||||
}
|
||||
|
||||
create(data) {
|
||||
const id = v4()
|
||||
return { id, ...data }
|
||||
}
|
||||
|
||||
delete(id) {}
|
||||
|
||||
query() {}
|
||||
}
|
||||
|
||||
export const music = new Store({
|
||||
name: '音乐(资源类型)',
|
||||
info: '音乐(类型说明)',
|
||||
存储时间: 1000 * 60 * 60 * 24 * 7, // 7天不使用的资源将被删除
|
||||
list: [{
|
||||
id: 'uuid',
|
||||
name: 'Dear big sisterremix ver.mp3',
|
||||
arrayBuffer: 'ArrayBuffer',
|
||||
createdAt: 1580000000000, // 创建时间
|
||||
updatedAt: 1580000000000, // 更新时间
|
||||
lastUsedAt: 1580000000000, // 最后使用时间
|
||||
}]
|
||||
})
|
||||
|
||||
export const chat = new Store({
|
||||
name: '聊天(资源类型)',
|
||||
info: '聊天(类型说明)',
|
||||
存储时间: 1000 * 60 * 60 * 24 * 7, // 7天不使用的资源将被删除
|
||||
list: [{
|
||||
id: 'uuid',
|
||||
name: 'Dear big sisterremix ver.mp3',
|
||||
arrayBuffer: 'ArrayBuffer',
|
||||
createdAt: 1580000000000, // 创建时间
|
||||
updatedAt: 1580000000000, // 更新时间
|
||||
lastUsedAt: 1580000000000, // 最后使用时间
|
||||
}]
|
||||
})
|
Loading…
Reference in New Issue
Block a user