-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrialVariation.js
More file actions
37 lines (31 loc) · 889 Bytes
/
trialVariation.js
File metadata and controls
37 lines (31 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* A variation of a condition
* @param condition
* @constructor
*/
var TrialVariation = function (condition) {
var self = this;
this.condition = condition;
// not serialized:
this.nr = ko.observable(0);
this.trialIdx = ko.observable(0);
this.uniqueId = ko.computed(function () {
var offset = condition.factorGroup.trialOffset();
return self.condition.trialStartIdx() + self.nr() + offset;
}, this);
};
/**
* load from a json object to deserialize the states.
* @param {object} data - the json description of the states.
* @returns {TrialVariation}
*/
TrialVariation.prototype.fromJS = function (data) {
return this;
};
/**
* serialize the state of this instance into a json object, which can later be restored using the method fromJS.
* @returns {object}
*/
TrialVariation.prototype.toJS = function () {
return {};
};