Class: Session
Constructors
new Session()
new Session(
options):Session
A Session contains one or more activities. The session manages the start and stop of activities, and advancement to next activity
Parameters
• options: SessionOptions
Returns
Defined in
m2c2kit/packages/session/src/Session.ts:45
Properties
currentActivity?
optionalcurrentActivity:Activity
Defined in
m2c2kit/packages/session/src/Session.ts:29
dataStores?
optionaldataStores:IDataStore[]
Defined in
m2c2kit/packages/session/src/Session.ts:31
options
options:
SessionOptions
Defined in
m2c2kit/packages/session/src/Session.ts:28
Accessors
nextActivity
Get Signature
get nextActivity():
undefined|Activity
Gets the next activity after the current one, or undefined if this is the last activity.
Returns
undefined | Activity
Defined in
m2c2kit/packages/session/src/Session.ts:750
uuid
Get Signature
get uuid():
string
Returns
string
Set Signature
set uuid(
value):void
Parameters
• value: string
Returns
void
Defined in
m2c2kit/packages/session/src/Session.ts:850
Methods
addStaticDiagnosticData()
addStaticDiagnosticData(
key,value):void
Sets the value of a variable that will be the same for all diagnostic data.
Parameters
• key: string
key (variable name) for the static diagnostic data
• value: undefined | null | string | number | boolean | object
value for the data
Returns
void
Remarks
This is useful for custom variables to appear in the diagnostic
data. For example, you might save the subject's participant ID, or some
other identifier that is not typically part of the diagnostic data. In
the example below, if an exception occurs, the participant_id variable
will be saved with the value 12345 within the diagnostic data.
Example
session.addStaticDiagnosticData("participant_id", "12345");
Defined in
m2c2kit/packages/session/src/Session.ts:884
advanceToNextActivity()
advanceToNextActivity():
Promise<void>
Stops the current activity and advances to next activity in the session. If there is no activity after the current activity, throws error.
Returns
Promise<void>
Deprecated
Use goToNextActivity() instead.
Defined in
m2c2kit/packages/session/src/Session.ts:742
dictionaryDeleteItem()
dictionaryDeleteItem(
key):boolean
Deletes an item value from the session's key-value dictionary.
Parameters
• key: string
item key
Returns
boolean
true if the item was deleted, false if it did not exist
Remarks
The session dictionary is not persisted. It is available only during the actively running session. It is useful for storing temporary data to coordinate between activities.