Constructor
new PsychObject(psychoJS, name)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
psychoJS |
module:core.PsychoJS | the PsychoJS instance |
name |
string | the name of the object (mostly useful for debugging) |
Extends
Members
psychoJS
- Source:
Get the PsychoJS instance.
psychoJS
- Source:
Setter for the PsychoJS attribute.
Methods
(protected) _addAttribute(name, value, defaultValueopt, onChangeopt)
- Source:
Add an attribute to this instance (e.g. define setters and getters) and affect a value to it.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | the name of the attribute |
|
value |
object | the value of the attribute |
|
defaultValue |
object |
<optional> |
the default value for the attribute |
onChange |
function |
<optional> |
function called upon changes to the attribute value |
(protected) _setAttribute(attributeName, attributeValue, logopt, operationopt, stealthopt) → {boolean}
- Source:
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 |
Returns:
whether or not the value of that attribute has changed (false if the attribute was not previously set)
- Type
- boolean
emit(name, data) → {boolean}
- Source:
- Overrides:
Emit an event with a given name and associated data.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | the name of the event |
data |
object | the data of the event |
Returns:
true if at least one listener has been registered for that event, and false otherwise
- Type
- boolean
off(name, listener)
- Source:
- Overrides:
Remove the listener with the given uuid associated to the given event name.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | the name of the event |
listener |
module:util.EventEmitter~Listener | a listener called upon emission of the event |
on(name, listener)
- Source:
- Overrides:
Register a new listener for events with the given name emitted by this instance.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | the name of the event |
listener |
module:util.EventEmitter~Listener | a listener called upon emission of the event |
Returns:
string - the unique identifier associated with that (event, listener) pair (useful to remove the listener)
once(name, listener)
- Source:
- Overrides:
Register a new listener for the given event name, and remove it as soon as the event has been emitted.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | the name of the event |
listener |
module:util.EventEmitter~Listener | a listener called upon emission of the event |
Returns:
string - the unique identifier associated with that (event, listener) pair (useful to remove the listener)
toString() → {string}
- Source:
String representation of the PsychObject.
Note: attribute values are limited to 50 characters.
Returns:
the representation
- Type
- string