JSMA session
Overview
The JSMA session provides functionality for handling sessions
What can JSMA session do for me?
It makes session handling easier by wrapping native JavaSript session handling methods
Index
Usage
writing data
Here is an example on how to write data to a JSMA session:
... session.set('username', 'IKONA-Admin') ...
reading data
Here is an example on how to read data from a JSMA session:
... var username = session.get('username'); ...
Methods
The JSMA session provides the following methods:
string session.get(key)
Returns the value of key as string or null if no value is set under the key.
Example
... var username = session.get('username'); ...
Parameter key:string (required)
The key to be looked up in the flexAttributes of the session.
boolean session.has(key)
Returns a boolean value depending on whether key is present for the current session
Example
... if (session.has('username') === true) { ... } ...
Parameter key:string(required)
The key to be checked in the flexAttributes of the session.
string session.id
Returns the id of the current session
Example
... var sessionId = session.id; ...
void session.pickup(newSessionId)
Allows you to switch between different sessions.
Example
... var searchedSession = session.pickup('baae790b7d53db6972fd20c679a9810c'); ...
Parameter newSessionId:String (required)
The desired new session ID.
session.set(key, value)
Sets the value of a specified key for the current session.
Example
... session.set('username', 'IKONA-Admin') ...
Parameter key:string (required)
The key to be set in the flexAttributes of the session.
Parameter value:string (required)
The value to be set for the key
session.withLock(duration, function)
Locks the currents session for a given time "duration" in seconds. The given function is executed while the lock is active
Example
... session.withLock(30, function { ... }) ...
Parameter duration (required)
The duration in seconds
Parameter function (required)
The function that is processed within the lock