Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/emoji-mart/src/helpers/store.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
/**
* Retrieves a stored value by key.
* @param key - The key of the stored value.
* @returns The retrieved value.
*/
function set(key: string, value: any) {
try {
window.localStorage[`emoji-mart.${key}`] = JSON.stringify(value)
} catch (error) {}
}

/**
* Stores a value under a specific key.
* @param key - The key to store the value under.
* @param value - The value to store.
*/
function get(key: string): any {
try {
const value = window.localStorage[`emoji-mart.${key}`]
Expand Down