Members
appIndex :number
The current app index of this participant.
0 indicates no current app.
Type:
- number
- Default Value:
- 0
- Source:
autoplay :boolean
Type:
- boolean
- Default Value:
- false
- Source:
clients :array
Type:
- array
- Default Value:
- []
- Source:
finishedApps
List of app ids that this participant has completed.
- Source:
frames :Array.<{run: App, player: Player, periodIndex: number}>
The apps within stages (see Stage#runFor) this participant is in, outermost first:
each with the player whose stage it is, and the participant's periodIndex there.
Type:
- Source:
id :String
Unique identifier for this participant.
Type:
- String
- Source:
outputHide :Array
'outputHide' fields are not included in output.
Type:
- Array
- Default Value:
- []
- Source:
outputHideAuto :Array.<String>
'outputHideAuto' fields are not included in output.
Type:
- Array.<String>
- Source:
periodIndex :number
Indexed at 0.
Type:
- number
- Default Value:
- -1
- Source:
player :Player
The current player of this participant.
Type:
- Default Value:
- null
- Source:
players :array
Type:
- array
- Default Value:
- []
- Source:
session :Session
Session for this participant.
Type:
- Source:
Methods
canStartStage()
Whether this participant can start stage, as player (by default, their current player).
- Source:
currentPlayerIn(app) → {Player|null}
This participant's player in app now: their current player, or, while they are in an
app within its stage (see Stage#runFor), the player whose stage that is. For an app of
the session they are not in, their player in the app of the session they are in (as
before apps had stages with stages); for an app within a stage, null.
Parameters:
| Name | Type | Description |
|---|---|---|
app |
App |
- Source:
Returns:
- Type
- Player | null
enterRun(stage, player)
This participant, as player, starts playing the stages of stage, a stage with stages
(see Stage#newStage, App#addApp): in the app they run as for player's period
(Stage#runFor), from its first period. When they finish it, they go back to player
(see exitRun).
Parameters:
| Name | Type | Description |
|---|---|---|
stage |
Stage | |
player |
Player |
- Source:
exitRun()
This participant has finished the app within a stage they are in (see enterRun): they go
back to the player whose stage it is, who ends it.
- Source:
getApp()
The app this participant is in: within a stage (see Stage#runFor), the innermost.
- Source:
isFinishedApp(app) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
app |
App | The given app. |
- Source:
Returns:
If the player is in a previous app, as given by the app's
indexInSession compared to the participant's appIndex, then return false.
If the player is in a previous app, return false.
If the player is in this app,
- not yet in the last period, return false.
- in the last period, but still 'playing', return false.
- in the last period and not 'playing', return true.
If the player is past this app, true.
- Type
- boolean
leaveRun(run)
This participant leaves run, an app within a stage they are in (see enterRun), and the
apps within its stages they are in: they go back to the player whose stage run is, who
ends it. As when they have finished it (exitRun), or when the stage's time is up.
Parameters:
| Name | Type | Description |
|---|---|---|
run |
App |
- Source:
moveToNextStage()
Move this participant to their next stage.
If the participant is already playing in an app as a player, call that player's Player#moveToNextStage function. Otherwise, call Session#participantMoveToNextApp.
- Source:
payment() → {number}
What this participant is paid: the session's show-up fee, plus the points of each app
times its exchange rate (app.exchangeRate, or the session's), rounded to cents.
- Source:
Returns:
- Type
- number
pointsForApp()
Returns the points the participant earned in the given app.
If app is null, returns points earned across all apps.
- Source:
restoreRuns()
After a session is loaded (see Session.load), with player the participant's player in
the app of the session they are in: the apps within stages they are in (see enterRun).
- Source:
roomId() → {type}
roomId - description
- Source:
Returns:
description
- Type
- type
skipToApp(index)
Ends this participant's current app (its later stages and periods too) and starts the app
at index (from 1) in the session's apps, or ends the session if there is none (oTree's
app_after_this_page).
Parameters:
| Name | Type | Description |
|---|---|---|
index |
number |
- Source:
stageId() → {type}
stageId - description
- Source:
Returns:
description
- Type
- type
topPlayer()
This participant's player in the app of the session they are in, or null.
- Source:
(static) load(json, session) → {type}
Parameters:
| Name | Type | Description |
|---|---|---|
json |
type | description |
session |
type | description |
- Source:
Returns:
description
- Type
- type