Files

11 lines
395 B
TypeScript
Raw Permalink Normal View History

2025-08-15 16:19:23 +08:00
import { sys } from "cc";
export default class KVStore {
constructor(private prefix = "app:") {}
private key(k: string) { return `${this.prefix}${k}`; }
get(k: string): string | null { return sys.localStorage.getItem(this.key(k)); }
set(k: string, v: string): void { sys.localStorage.setItem(this.key(k), v); }
remove(k: string): void { sys.localStorage.removeItem(this.key(k)); }
}