This commit is contained in:
syuilo
2025-03-10 11:17:08 +09:00
parent db5c6fa3c2
commit 05078e9c14
2 changed files with 6 additions and 6 deletions

View File

@@ -36,7 +36,8 @@ type PizzaxChannelMessage<T extends StateDef> = {
userId?: string; userId?: string;
}; };
class Store<T extends StateDef> extends Pizzax<State<T>> { // TODO: export消す
export class Store<T extends StateDef> extends Pizzax<State<T>> {
public readonly def: T; public readonly def: T;
public readonly ready: Promise<void>; public readonly ready: Promise<void>;
@@ -60,7 +61,7 @@ class Store<T extends StateDef> extends Pizzax<State<T>> {
return promise; return promise;
} }
constructor(def: T) { constructor(def: T, key = 'base') {
const data = {} as State<T>; const data = {} as State<T>;
for (const [k, v] of Object.entries(def) as [keyof T, T[keyof T]['default']][]) { for (const [k, v] of Object.entries(def) as [keyof T, T[keyof T]['default']][]) {
@@ -69,7 +70,6 @@ class Store<T extends StateDef> extends Pizzax<State<T>> {
super(data); super(data);
const key = 'base';
this.key = key; this.key = key;
this.deviceStateKeyName = `pizzax::${key}`; this.deviceStateKeyName = `pizzax::${key}`;
this.deviceAccountStateKeyName = $i ? `pizzax::${key}::${$i.id}` : ''; this.deviceAccountStateKeyName = $i ? `pizzax::${key}::${$i.id}` : '';

View File

@@ -5,10 +5,10 @@
import { markRaw } from 'vue'; import { markRaw } from 'vue';
import type { Column } from '@/deck.js'; import type { Column } from '@/deck.js';
import { Storage } from '@/pizzax.js'; import { Store } from '@/store.js';
// TODO: 消す(移行済みのため) // TODO: 消す(移行済みのため)
export const deckStore = markRaw(new Storage('deck', { export const deckStore = markRaw(new Store({
profile: { profile: {
where: 'deviceAccount', where: 'deviceAccount',
default: 'default', default: 'default',
@@ -21,4 +21,4 @@ export const deckStore = markRaw(new Storage('deck', {
where: 'deviceAccount', where: 'deviceAccount',
default: [] as Column['id'][][], default: [] as Column['id'][][],
}, },
})); }, 'deck'));