Argument | Type | Description |
---|---|---|
name | String | The name of this task. If used as part of miManager, this setting may be overided by the manager task object. |
(Object) this API
API.setName('taskName');
Argument | Type | Description |
---|---|---|
name | String | The name of the setting that you want to change. |
setting | * or Object | The setting value. If this is an object, it will extend the existing setting object instead of overwriting it. |
(Object) this API
API.addSettings('onEnd', function(){
// something to do at the end of the task
});
Argument | Type | Description |
---|---|---|
sequence | Array or Object | An array of objects or a single object to add to the sequence (for example, trial or page objects). |
(Object) this API
API.addSequence([
trial1,
trial2
]);
Each task API has one or more “addSet” functions. These function take the form add<*SetName*>Set
so that, for instance pages use the API.addPagesSet
function and tasks use the API.addTaskSet
function. They are used in order to register prototypes of objects for the sequencer inheritance system.
Argument | Type | Description |
---|---|---|
setName | String | The name of the set to be registered. |
setArray | Array or Object | An array or object to add this this set. |
This function has an alternative notation : add<*SetName*>Set(setName, setArray)
.
Argument | Type | Description |
---|---|---|
setsObject | String | An object where each property name is a setName and the content is the set content. |
Task | setName | Function Name |
---|---|---|
miManager | tasks | addTasksSet |
miQuest | pages | addPagesSet |
questions | addQuestionsSet | |
miTime | trial | addTrialSet |
stimulus | addStimulusSet | |
media | addMediaSet |
‘undefined’
First notation:
API.addTrialSet('set1', trial1);
API.addTrialSet('set2', [trial2, trial3]);
Second notation. Does the same thing as the first pair:
API.addTrialSet({
set1: [trial1],
set2: [trial2,trial3]
});
Argument | Type | Description |
---|---|---|
obj | Object | An object to merged into the global object |
(Object) global
object.
API.addGlobal({myFlag: true});
(Object) global
object.
var global = API.getGlobal();
global.myFlag = true;
Argument | Type | Description |
---|---|---|
obj | Object | An object to merged into the current object. |
(Object) current
object.
API.addCurrent({myFlag: true});
(Object) current
object.
var current = API.getCurrent();
current.myFlag = true;
Posts JSONified data to the server.
Argument | Type | Description |
---|---|---|
url | String | The url to post to. |
object | object | An Object to be JSONified then posted. |
(Promise) a promise to be resolved when the post completes.
API.post('my/server/url', {my:'data'});
Returns an array of shuffled values, using a version of the Fisher-Yates shuffle (Uses lodash shuffle).
Argument | Type | Description |
---|---|---|
collection | Array, Object or String | The collection to shuffle. |
(Array) The new shuffled array.
var shuffled = API.shuffle([1,2,3,4]);
console.log(shuffled); // prints [4, 1, 3, 2] for example
This function is available only on the project implicit build. Posts JSONified data to the server.
Argument | Type | Description |
---|---|---|
object | object | An Object to be JSONified then posted. |
(Promise) a promise to be resolved when the post completes.
API.save({my:'data'});