ISessionManager
Defined in: session/manager.ts:46
Interface for session managers.
Session managers track and manage external resources (browser pages, API connections, etc.) that need to be shared across multiple gadgets and properly cleaned up.
Type Parameters
Section titled “Type Parameters”TSession
Section titled “TSession”TSession = unknown
Type of session object (e.g., Page, APIClient)
TConfig
Section titled “TConfig”TConfig = unknown
Configuration type for creating sessions
Methods
Section titled “Methods”closeAll()
Section titled “closeAll()”closeAll():
Promise<void>
Defined in: session/manager.ts:82
Close all sessions.
Returns
Section titled “Returns”Promise<void>
closeSession()
Section titled “closeSession()”closeSession(
id):Promise<void>
Defined in: session/manager.ts:77
Close and remove a session.
Parameters
Section titled “Parameters”string
Session ID to close
Returns
Section titled “Returns”Promise<void>
createSession()
Section titled “createSession()”createSession(
config?):Promise<string>
Defined in: session/manager.ts:53
Create a new session.
Parameters
Section titled “Parameters”config?
Section titled “config?”TConfig
Optional configuration for the session
Returns
Section titled “Returns”Promise<string>
Promise resolving to the session ID
getSession()
Section titled “getSession()”getSession(
id):TSession|undefined
Defined in: session/manager.ts:61
Get a session by ID.
Parameters
Section titled “Parameters”string
Session ID
Returns
Section titled “Returns”TSession | undefined
Session object or undefined if not found
hasSession()
Section titled “hasSession()”hasSession(
id):boolean
Defined in: session/manager.ts:97
Check if a session exists.
Parameters
Section titled “Parameters”string
Session ID
Returns
Section titled “Returns”boolean
True if session exists
listSessions()
Section titled “listSessions()”listSessions():
string[]
Defined in: session/manager.ts:89
List all active session IDs.
Returns
Section titled “Returns”string[]
Array of session IDs
requireSession()
Section titled “requireSession()”requireSession(
id):TSession
Defined in: session/manager.ts:70
Get a session by ID, throwing if not found.
Parameters
Section titled “Parameters”string
Session ID
Returns
Section titled “Returns”TSession
Session object
Throws
Section titled “Throws”Error if session not found