Class: Window

core.Window(options)

new Window(options)

Window displays the various stimuli of the experiment.

It sets up a PIXI renderer, which we use to render the experiment stimuli.

Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Default Description
psychoJS PsychoJS the PsychoJS instance
name string <optional>
the name of the window
fullscr boolean <optional>
false whether or not to go fullscreen
color Color <optional>
Color('black') the background color of the window
units string <optional>
'pix' the units of the window
autoLog boolean <optional>
true whether or not to log
Source:

Extends

  • PsychObject

Methods

(private) _onResize(win)

Treat a window resize event.

We adjust the size of the renderer and the position of the root container.

Note: since this method will be called by the DOM window (i.e. 'this' is the DOM window), we need to pass it a Window.

Parameters:
Name Type Description
win Window The PsychoJS window
Source:

(private) _refresh()

Recompute the window's _drawList and _container children for the next animation frame.
Source:

(private) _setupPixi()

Setup PIXI.

A new renderer is created and a container is added to it. The renderer's touch and mouse events are handled by the EventManager.

Source:

(private) _updateIfNeeded()

Update this window, if need be.
Source:

(private) _writeLogOnFlip()

Send all logged messages to the Logger.
Source:

adjustScreenSize()

Take the browser full screen if possible.
Source:

callOnFlip(flipFunction, flipArgs)

Specify the callback function ran after each screen flip, i.e. immedicately after each rendering of the Window.

This is typically used to reset a timer or clock.

Parameters:
Name Type Description
flipFunction * callback function.
flipArgs Object arguments for the callback function.
Source:

close()

Close the window.

Note: this actually only removes the canvas used to render the experiment stimuli.

Source:

experimentEnded()

Setter for experimentEnded.
Source:

experimentEnded()

Getter for experimentEnded.
Source:

experimentHandler()

Getter for experimentHandler.
Source:

experimentHandler()

Setter for experimentHandler.
Source:

getActualFrameRate() → {number}

Estimate the frame rate.
Source:
To Do:
  • estimate the actual frame rate.
Returns:
always returns 60.0 at the moment
Type
number

logOnFlip(options, level, objopt)

Log a message.

Note: the message will be time-stamped at the next call to requestAnimationFrame.

Parameters:
Name Type Attributes Description
options Object
Properties
Name Type Description
msg String the message to be logged
level integer the log level
obj Object <optional>
the object associated with the message
Source:

monitorFramePeriod()

Getter for monitorFramePeriod.
Source:

render()

Render the stimuli onto the canvas.
Source: