-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
30 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@onflow/fcl": minor | ||
--- | ||
|
||
Use localStorage as default & export LOCAL_STORAGE/SESSION_STORAGE as helpers for fcl.storage.default configuration key |
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 |
---|---|---|
@@ -1,21 +1,8 @@ | ||
const isServerSide = () => typeof window === "undefined" | ||
|
||
const getSessionStorage = () => { | ||
try { | ||
const SESSION_STORAGE = { | ||
can: !isServerSide(), | ||
get: async key => JSON.parse(sessionStorage.getItem(key)), | ||
put: async (key, value) => sessionStorage.setItem(key, JSON.stringify(value)), | ||
} | ||
return SESSION_STORAGE | ||
} catch (error) { | ||
return null | ||
} | ||
} | ||
import {LOCAL_STORAGE} from "./storage" | ||
|
||
export const getDefaultConfig = () => { | ||
return { | ||
"discovery.wallet.method.default": "IFRAME/RPC", | ||
"fcl.storage.default": getSessionStorage(), | ||
"fcl.storage.default": LOCAL_STORAGE, | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export {renderFrame} from './render-frame' | ||
export {renderPop} from './render-pop' | ||
export {renderTab} from './render-tab' | ||
export {getDefaultConfig} from './default-config' | ||
export {coreStrategies} from './coreStrategies' | ||
export {renderFrame} from "./render-frame" | ||
export {renderPop} from "./render-pop" | ||
export {renderTab} from "./render-tab" | ||
export {getDefaultConfig} from "./default-config" | ||
export {coreStrategies} from "./coreStrategies" | ||
export {LOCAL_STORAGE, SESSION_STORAGE} from "./storage" |
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,13 @@ | ||
const isServerSide = () => typeof window === "undefined" | ||
|
||
export const SESSION_STORAGE = { | ||
can: !isServerSide(), | ||
get: async key => JSON.parse(sessionStorage.getItem(key)), | ||
put: async (key, value) => sessionStorage.setItem(key, JSON.stringify(value)), | ||
} | ||
|
||
export const LOCAL_STORAGE = { | ||
can: !isServerSide(), | ||
get: async key => JSON.parse(localStorage.getItem(key)), | ||
put: async (key, value) => localStorage.setItem(key, JSON.stringify(value)), | ||
} |