初始化存储
This commit is contained in:
parent
06479610f9
commit
e5c9623092
@ -1,5 +1,4 @@
|
|||||||
import 'virtual:windi.css'
|
import 'virtual:windi.css'
|
||||||
//import 'virtual:windi-devtools'
|
|
||||||
|
|
||||||
import IndexedDB from './indexeddb.js'
|
import IndexedDB from './indexeddb.js'
|
||||||
import MusicList from './music.js'
|
import MusicList from './music.js'
|
||||||
@ -25,9 +24,11 @@ function appendBuffer(buffer1, buffer2) {
|
|||||||
|
|
||||||
// 读取本地音乐列表并标识为缓存状态(本地缓存)
|
// 读取本地音乐列表并标识为缓存状态(本地缓存)
|
||||||
const database = new IndexedDB('musicDatabase', 1)
|
const database = new IndexedDB('musicDatabase', 1)
|
||||||
const musicStore = await database.store('musicObjectStore')
|
await database.store('musicObjectStore') // 音乐(为什么会用这么丑的格式呢)
|
||||||
|
await database.store('imageObjectStore') // 图像(为什么会用这么丑的格式呢)
|
||||||
|
await database.store('chatsObjectStore') // 聊天室
|
||||||
|
|
||||||
//// 读取本地音乐列表并标识为缓存状态(本地缓存)
|
// 读取本地音乐列表并标识为缓存状态(本地缓存)
|
||||||
const list = (await database.getAll('musicObjectStore')).map(item => {
|
const list = (await database.getAll('musicObjectStore')).map(item => {
|
||||||
return { save: true, ...item }
|
return { save: true, ...item }
|
||||||
})
|
})
|
||||||
@ -36,7 +37,6 @@ const list = (await database.getAll('musicObjectStore')).map(item => {
|
|||||||
const name = localStorage.getItem('username') ?? '匿'
|
const name = localStorage.getItem('username') ?? '匿'
|
||||||
const avatar = localStorage.getItem('avatar') ?? '/favicon.ico'
|
const avatar = localStorage.getItem('avatar') ?? '/favicon.ico'
|
||||||
|
|
||||||
|
|
||||||
// 初始化客户端列表
|
// 初始化客户端列表
|
||||||
const clientList = new ClientList({
|
const clientList = new ClientList({
|
||||||
name,
|
name,
|
||||||
@ -56,7 +56,6 @@ const clientList = new ClientList({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// 初始化音乐列表(加入本地缓存)
|
// 初始化音乐列表(加入本地缓存)
|
||||||
const musicList = new MusicList({
|
const musicList = new MusicList({
|
||||||
list,
|
list,
|
||||||
|
Loading…
Reference in New Issue
Block a user