# JSDoc: Class: Window

# 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` | module:core.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
`gamma` | number | <optional> | 1 | sets the divisor for gamma correction. In other words gamma correction is calculated as pow(rgb, 1/gamma)
`contrast` | number | <optional> | 1 | sets the contrast value
`units` | string | <optional> | 'pix' | the units of the window
`waitBlanking` | boolean | <optional> | false | whether or not to wait for all rendering operations to be done before flipping
`autoLog` | boolean | <optional> | true | whether or not to log

Source:
  - core/Window.js, line 17

### Extends

- PsychObject

### Methods

#### addPixiObject()

Add PIXI.DisplayObject to the container displayed on the scene (window)

Source:
  - core/Window.js, line 308

#### adjustScreenSize()

Take the browser full screen if possible.

Source:
  - core/Window.js, line 178

#### callOnFlip(flipCallback, …flipCallbackArgs)

Add a callback function that will run after the next screen flip, i.e. immediately after the next rendering of the Window.

This is typically used to reset a timer or clock.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`flipCallback` | module:core.Window~OnFlipCallback |  | callback function.
`flipCallbackArgs` | * | <repeatable> | arguments for the callback function.

Source:
  - core/Window.js, line 291

#### close()

Close the window.

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

Source:
  - core/Window.js, line 123

#### closeFullScreen()

Take the browser back from full screen if needed.

Source:
  - core/Window.js, line 223

#### experimentHandler()

Getter for experimentHandler.

Source:
  - data/TrialHandler.js, line 33

#### experimentHandler()

Setter for experimentHandler.

Source:
  - data/TrialHandler.js, line 45

#### getActualFrameRate() → {number}

Estimate the frame rate.

Source:
  - core/Window.js, line 161

##### Returns:

rAF based delta time based approximation, 60.0 by default

Type
  number

#### logOnFlip(options, levelopt, objopt)

Log a message.

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

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---

`options`

Object

###### Properties

Name | Type | Description
--- | --- | ---
`msg` | String | the message to be logged

`level` | module:util.Logger.ServerLevel | <optional> | module:util.Logger.ServerLevel.EXP | the log level
`obj` | Object | <optional> |  | the object associated with the message

Source:
  - core/Window.js, line 263

#### monitorFramePeriod()

Getter for monitorFramePeriod.

Source:
  - core/Window.js, line 38

#### removePixiObject()

Remove PIXI.DisplayObject from the container displayed on the scene (window)

Source:
  - core/Window.js, line 320

#### render()

Render the stimuli onto the canvas.

Source:
  - core/Window.js, line 332

### Type Definitions

#### OnFlipCallback(argsopt)

Callback function for callOnFlip.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`args` | * | <optional> | optional arguments

Source:
  - core/Window.js, line 285