embedページの判定をconfig.tsに移行

This commit is contained in:
kakkokari-gtyih
2024-06-29 17:18:32 +09:00
parent 1926fa304b
commit 237605d6b8
9 changed files with 24 additions and 26 deletions

View File

@@ -47,20 +47,20 @@ const safeSessionStorage = new Map<Keys, string>();
export const miLocalStorage = {
getItem: (key: Keys): string | null => {
if (isEmbedPage()) {
if (embedPage) {
return safeSessionStorage.get(key) ?? null;
}
return window.localStorage.getItem(key);
},
setItem: (key: Keys, value: string): void => {
if (isEmbedPage()) {
if (embedPage) {
safeSessionStorage.set(key, value);
} else {
window.localStorage.setItem(key, value);
}
},
removeItem: (key: Keys): void => {
if (isEmbedPage()) {
if (embedPage) {
safeSessionStorage.delete(key);
} else {
window.localStorage.removeItem(key);
@@ -78,7 +78,7 @@ export const miLocalStorage = {
},
};
if (isEmbedPage()) {
if (embedPage) {
initEmbedPageLocalStorage();
if (_DEV_) console.warn('Using safeSessionStorage as localStorage alternative');
}