mirror of
https://github.com/streamyfin/streamyfin.git
synced 2025-08-20 18:37:18 +02:00
22 lines
566 B
TypeScript
22 lines
566 B
TypeScript
import {MMKV} from "react-native-mmkv";
|
|
|
|
declare module "react-native-mmkv" {
|
|
interface MMKV {
|
|
get<T>(key: string): T | undefined
|
|
setAny(key: string, value: any | undefined): void
|
|
}
|
|
}
|
|
|
|
MMKV.prototype.get = function <T> (key: string): T | undefined {
|
|
const serializedItem = this.getString(key);
|
|
return serializedItem ? JSON.parse(serializedItem) : undefined;
|
|
}
|
|
|
|
MMKV.prototype.setAny = function (key: string, value: any | undefined): void {
|
|
if (value === undefined) {
|
|
this.delete(key)
|
|
}
|
|
else {
|
|
this.set(key, JSON.stringify(value));
|
|
}
|
|
} |