StorageManager
@vimp-mp/types 2.0.1Persistent JSON storage scoped to the current server.
ts
interface StorageManagerMembers
clear
ts
clear(prefix?: string): numberRemoves all keys, or only keys that start with prefix. Returns the removed count.
getItem
ts
getItem<T = unknown>(key: string): T | nullReturns null when the key is missing. Saved null also reads as null; use hasItem to distinguish those states.
hasItem
ts
hasItem(key: string): booleanReports whether the current server namespace contains key.
keys
ts
keys(prefix?: string): Array<string>Returns all keys, or only keys that start with prefix.
removeItem
ts
removeItem(key: string): booleanRemoves one key. Returns true only when a value was removed.
setItem
ts
setItem<T>(key: string, value: T): voidPersists a JSON-serializable value in the current server namespace.