Class: Stage

Stage()

A stage of an App. A stage is an app: one shown on a screen (activeScreen), or one
with stages of its own (see newStage), or an app's file (see App#addApp), played as a step
of its app. It has an app's members (newStage, addApp, numPeriods, groupSize, the hooks,
...), and what it does not set is its app's.

Constructor

new Stage()

Source:

Members

activeScreen

Default Value:
  • null
Source:

app :App

the app of this stage.

Type:
Source:

appPath

The file of this stage's app.

Source:

clientDuration :number

Seconds each player has for this stage, from when they start it (oTree's page
timeout); see getClientDuration(player) for a
duration per player. Their page counts down and submits; if it does not, the server
ends the stage for them, as for a group's timeout (see timeoutGrace). If <= 0, none.

Type:
  • number
Default Value:
  • 0
Source:

duration :number

timeout duration in seconds
if <= 0, then no timeout for this stage.

Type:
  • number
Default Value:
  • 0
Source:

endOnTimeout :boolean

When the stage times out (duration or clientDuration), end it (true); or only mark
the players timed out and keep it open until they submit (false: z-Tree's "leave
stage after timeout: no").

Type:
  • boolean
Default Value:
  • true
Source:

html

Default Value:
  • null
Source:

htmlFile

Default Value:
  • null
Source:

id :String

The identifier of this stage.

Type:
  • String
Source:

jt

The jtree of this stage's app.

Source:

name :Name

for display only, should be unique.

Type:
  • Name
Source:

onPlaySendPlayer :boolean

when starting stage for a player, send 'player' object or not.
fields determined by player.outputFields.

Type:
  • boolean
Default Value:
  • true
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:

repetitions :number

For a stage with stages of its own (see newStage), the number of times its stages
are played each time its group reaches it, if numPeriods is not set.

Type:
  • number
Default Value:
  • 1
Source:

session :Session

The session of this stage's app.

Type:
Source:

stages :Array.<Stage>

The stages within this stage: its own (see newStage), or, for an app added as a stage
(see App#addApp), that app's.

Type:
Source:

timeoutGrace :number|null

When this stage times out and Stage#waitOnTimerEnd is true, each player's
page is asked to submit what it has. After this many seconds, the server ends the
stage for players whose page has not (as if they submitted nothing); null waits
for the pages however long they take.

Type:
  • number | null
Default Value:
  • 5
Source:

updateObject :string

how far up the tree should be sent on update. More data comes at cost of higher latency.
possible values: 'player', 'group'

Type:
  • string
Default Value:
  • 'player'
Source:

useAppActiveScreen :boolean

Type:
  • boolean
Default Value:
  • true
Source:

useAppWaitingScreen :boolean

Type:
  • boolean
Default Value:
  • true
Source:

useIdAsHTMLFileName :boolean

Type:
  • boolean
Default Value:
  • true
Source:

waitForAllGroups :boolean

Wait for every player of the period, in every group, to be 'ready' before any group
starts this stage (z-Tree's "wait for all", oTree's wait_for_all_groups). Then
Stage.allGroupsStart(period) is called, once, before
the groups' groupStart.

Type:
  • boolean
Default Value:
  • false
Source:

waitOnTimerEnd :boolean

Wait for all players to finish stage on their own (true), or end anyway (false).

Type:
  • boolean
Default Value:
  • true
Source:

waitToEnd :boolean

Wait for all players in group to be 'finished' or 'done' before calling Stage.groupEnd(group) and Stage.playerStart(player) are called.

Type:
  • boolean
Default Value:
  • true
Source:

waitToStart :boolean

Wait for all players in group to be 'ready' before calling Stage.groupStart(group) and Stage.playerStart(player) are called.

Type:
  • boolean
Default Value:
  • true
Source:

wrapPlayingScreenInFormTag

Wrap stage playing screens in a

tag or not.

Source:

Methods

addApp(file, optionsopt, idopt) → {Stage}

Adds the app in file as a stage within this stage (see newStage, App#addApp).

Parameters:
Name Type Attributes Description
file string

The app's file, or folder, relative to this stage's app's folder.

options Object <optional>

The app's option values.

id string <optional>

The id of the stage; by default, the app's.

Source:
Returns:

The new stage.

Type
Stage

allGroupsStart(period)

Overwrite in app.jtt: for a stage that waits for all groups, called once per period
when every player has arrived, before each group's groupStart.

Parameters:
Name Type Description
period Period
Source:

blockApp()

The app this stage's stages are in (see App#newBlock), made the first time it is asked for.

Source:

canPlayerParticipate(player) → {type}

Can the given player participate in this stage?

Parameters:
Name Type Description
player type

description

Source:
Returns:

description

Type
type

groupEnd(group) → {type}

Overwrite in app.jtt.

Parameters:
Name Type Description
group type

description

Source:
Returns:

description

Type
type

groupStart()

Called before the first player plays this stage.
Overwrite in app.jtt

Source:

indexInApp() → {type}

indexInApp - description

Source:
Returns:

description

Type
type

isContainer()

Whether this stage has stages of its own, or is an app (see newStage, App#addApp).

Source:

newStage(idopt) → {Stage}

Adds a stage within this stage. A stage with stages is an app within its app: each time
a group reaches it, its players play its stages, numPeriods times (repetitions, if
that is not set), in periods of their own, and then go on to the next stage of this
stage's app. By default they keep their groups; with groupSize, numGroups,
groupMatchingType or getGroupIdsForPeriod(period) set on this stage, they are
regrouped, as an app's players are. periodStart(period) and periodEnd(period), if set
on this stage, are called as an app's are. See App#newBlock.

Parameters:
Name Type Attributes Description
id string <optional>
Source:
Returns:

The new stage.

Type
Stage

playerEnd(player)

End this stage for the given player.
Overwrite in app.jtt.

Parameters:
Name Type Description
player type

description

Source:

playerStart()

Called when this player plays this stage.
Overwrite in app.jtt.

Source:

runFor(period) → {App}

The app this stage's stages run as in period (a period of this stage's app), for the
time period's groups reach this stage: made the first time it is asked for. For an app
added as a stage (see App#addApp), that app, loaded afresh.

Parameters:
Name Type Description
period Period
Source:
Returns:
Type
App

runIn()

The app this stage's stages run as in period, if its groups have reached it; else null.

Source:

save() → {type}

Source:
Returns:

description

Type
type

shell() → {type}

Source:
Returns:

description

Type
type

shellWithParent() → {type}

shellWithParent - description

Source:
Returns:

description

Type
type