Class: Session

Session

new Session(options=)

Parameters:
Name Type Argument Default Description
options= Object <optional>
A configuration map for the Session
options.sessionId string <optional>
Utilities.GUID() A sessionId for session.
options.appId string <optional>
new Date().toISOString() The start Timestamp (default now).
options.sessionLength number <optional>
600000 Length of session in Milliseconds (default 10 minutes).
options.expirationCallback AMA.Session.ExpirationCallback <optional>
Callback Function for when a session expires
options.logger= AMA.Client.Logger <optional>
Object containing javascript style logger functions (passing console will output to browser dev consoles)
Source:

Methods

clearSession()

Clear session from storage system
Source:

expireSession(Callback)

Expire session and clear session
Parameters:
Name Type Argument Description
Callback expirationCallback <optional>
function to call when sessions expire
Source:

extendSession(sessionExtensionLength)

Extend session by adding to the expiration timestamp
Parameters:
Name Type Argument Default Description
sessionExtensionLength int <optional>
sessionLength The number of milliseconds to add to the expiration date (session length by default).
Source:

resetSessionTimeout(milliseconds)

Reset session timeout to expire in a given number of seconds
Parameters:
Name Type Argument Default Description
milliseconds int <optional>
sessionLength The number of milliseconds until the session should expire (from now).
Source:

setSessionTimeout(timeout)

Setter for the session timeout
Parameters:
Name Type Description
timeout int epoch timestamp
Source:

stopSession(stopDate)

Parameters:
Name Type Argument Default Description
stopDate string <optional>
now The ISO Date String to set the stopTimestamp to (now for default).
Source:

Type Definitions

ExpirationCallback(session) → {boolean|int}

Parameters:
Name Type Description
session AMA.Session
Source:
Returns:
- Returns either true to extend the session by the sessionLength or an int with the number of seconds to extend the session. All other values will clear the session from storage.
Type
boolean | int