#
LocalStorageSessionManager
A local storage session manager (strictly for development purpose).
#
Reference
const sessionManager = new LocalStorageSessionManager(options?: { key? })
#
Parameters
options
: An optional object literal of options:key
: An optional key identifying the session inlocalStorage
.
#
Usage
#
Create a manager instance
import { LocalStorageSessionManager } from "@squide/fakes";
import type { Session } from "@sample/share";
const sessionManager = new LocalStorageSessionManager<Session>();
#
Set a session
sessionManager.setSession({ username: "Foo" });
#
Get the current session
const session = sessionManager.getSession();
#
Clear the current session
sessionManager.clearSession();