Class: PsychObject

util.PsychObject(psychoJS, name)

PsychoObject is the base class for all PsychoJS objects. It is responsible for handling attributes.

Constructor

new PsychObject(psychoJS, name)

Parameters:
Name Type Description
psychoJS module:core.PsychoJS the PsychoJS instance
name string the name of the object (mostly useful for debugging)
Source:

Extends

  • EventEmitter

Members

psychoJS

Get the PsychoJS instance.
Source:

psychoJS

Setter for the PsychoJS attribute.
Source:

Methods

(protected) _addAttribute(name, value)

Add an attribute to this instance (e.g. define setters and getters) and affect a value to it.
Parameters:
Name Type Description
name string the name of the attribute
value object the value of the attribute
Source:

(protected) _addAttributes(cls, …argsopt)

Add attributes to this instance (e.g. define setters and getters) and affect values to them.

Notes:

  • If the object already has a set method, we do not redefine it, and the setter for this attribute calls that method instead of _setAttribute.
  • _addAttributes is typically called in the constructor of an object, after the call to super (see module:visual.ImageStim for an illustration).

Parameters:
Name Type Attributes Description
cls Object the class object of the subclass of PsychoObject whose attributes we will set
args * <optional>
<repeatable>
the values for the attributes (this also determines which attributes will be set)
Source:

(private) _setAttribute(attributeName, attributeValue, logopt, operationopt, stealthopt) → {boolean}

Set the value of an attribute.
Parameters:
Name Type Attributes Default Description
attributeName string the name of the attribute
attributeValue object the value of the attribute
log boolean <optional>
false whether of not to log
operation string <optional>
the binary operation such that the new value of the attribute is the result of the application of the operation to the current value of the attribute and attributeValue
stealth boolean <optional>
false whether or not to call the potential attribute setters when setting the value of this attribute
Source:
Returns:
whether or not the value of that attribute has changed (false if the attribute was not previously set)
Type
boolean