feat(goja): implement localStorage API and add global types
This commit is contained in:
15
global-types/globals.d.ts
vendored
15
global-types/globals.d.ts
vendored
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user