feat(goja): implement localStorage API and add global types

This commit is contained in:
ExplodingDragon
2026-02-01 00:06:47 +08:00
parent 695cbdf979
commit b4c0ae11df
3 changed files with 107 additions and 1 deletions

View File

@@ -146,6 +146,21 @@ declare global {
const kv: KVSystem;
// localStorage 模拟
interface Storage {
getItem(key: string): string | null;
setItem(key: string, value: string): void;
removeItem(key: string): void;
clear(): void;
key(index: number): string | null;
}
const localStorage: Storage;
// Console 相关 (假设通过 require 引入)
interface Console {
log(...args: any[]): void;