-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(project): implement enablecontinuewatching config setting
- Loading branch information
Showing
7 changed files
with
86 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* | ||
* Persist util: store items to localStorage | ||
* | ||
*/ | ||
|
||
const LOCAL_STORAGE_PREFIX = `jwshowcase.`; | ||
|
||
const setItem = (key: string, value: unknown) => { | ||
const storageKey = `${LOCAL_STORAGE_PREFIX}${key}`; | ||
const storageValue = JSON.stringify(value); | ||
|
||
try { | ||
window.localStorage.setItem(storageKey, storageValue); | ||
} catch (error: unknown) { | ||
console.error(error); | ||
} | ||
}; | ||
|
||
const getItem = (key: string) => { | ||
const storageKey = `${LOCAL_STORAGE_PREFIX}${key}`; | ||
|
||
try { | ||
return parseJSON(window.localStorage.getItem(storageKey)); | ||
} catch (error: unknown) { | ||
console.error(error); | ||
} | ||
}; | ||
|
||
const parseJSON = (value?: string | null): unknown | undefined => { | ||
if (!value) return; | ||
|
||
try { | ||
const parsedValue = JSON.parse(value); | ||
|
||
return parsedValue; | ||
} catch (error: unknown) { | ||
return; | ||
} | ||
}; | ||
|
||
export { setItem, getItem }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export type WatchHistoryItem = { | ||
mediaid: string; | ||
position: number; | ||
}; |