arlac77/svelte-session-manager

q: How i can dinamicly change backing session store?

Closed this issue · 2 comments

Something like:

$: save = some boolean conditions...( true/false )

const session = new Session(save ? localStorage : sessionStorage)

with cf6fd9fa611a82b95c781107eaa058477bf4ec78 released in 1.4.0 You can

const session = new Session(localStorage)


// later
session.store = sessionStorage;

But be aware the currently the content of the former store will not be transferred to the new store

Tx very much🤓now I can use remember checkbox 👍🏻for localStorage. & I don’t need dynamically change back store, just on authentication when initialise session.