@decidables/discountable-elements 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/LICENSE.md +1003 -0
- package/README.md +1405 -0
- package/lib/discountableElements.esm.js +23333 -0
- package/lib/discountableElements.esm.js.map +1 -0
- package/lib/discountableElements.esm.min.js +1625 -0
- package/lib/discountableElements.esm.min.js.map +1 -0
- package/lib/discountableElements.umd.js +23353 -0
- package/lib/discountableElements.umd.js.map +1 -0
- package/lib/discountableElements.umd.min.js +1625 -0
- package/lib/discountableElements.umd.min.js.map +1 -0
- package/package.json +69 -0
- package/src/components/discountable-control.js +173 -0
- package/src/components/discountable-response.js +283 -0
- package/src/components/htd-calculation.js +230 -0
- package/src/components/htd-curves.js +1073 -0
- package/src/components/htd-fit-worker.js +71 -0
- package/src/components/htd-fit.js +197 -0
- package/src/components/index.js +9 -0
- package/src/components/itc-choice.js +134 -0
- package/src/components/itc-option.js +173 -0
- package/src/components/itc-task.js +253 -0
- package/src/discountable-element.js +105 -0
- package/src/equations/adk2v.js +135 -0
- package/src/equations/htd-equation.js +202 -0
- package/src/equations/index.js +3 -0
- package/src/examples/htd-example.js +73 -0
- package/src/examples/human.js +154 -0
- package/src/examples/index.js +4 -0
- package/src/examples/interactive.js +123 -0
- package/src/examples/model.js +179 -0
- package/src/index.js +6 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
|
|
2
|
+
import {html, css} from 'lit';
|
|
3
|
+
|
|
4
|
+
import DiscountableElement from '../discountable-element';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
CPTExample Base Class - Not intended for instantiation!
|
|
8
|
+
<sdt-example>
|
|
9
|
+
*/
|
|
10
|
+
export default class HTDExample extends DiscountableElement {
|
|
11
|
+
static get styles() {
|
|
12
|
+
return [
|
|
13
|
+
super.styles,
|
|
14
|
+
css`
|
|
15
|
+
:host {
|
|
16
|
+
---border: var(--border, 1px solid var(---color-border));
|
|
17
|
+
display: inline-block;
|
|
18
|
+
|
|
19
|
+
margin-bottom: 1rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.holder {
|
|
23
|
+
display: flex;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.body {
|
|
27
|
+
display: flex;
|
|
28
|
+
|
|
29
|
+
flex-wrap: wrap;
|
|
30
|
+
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: left;
|
|
33
|
+
|
|
34
|
+
padding: 0.625rem;
|
|
35
|
+
|
|
36
|
+
border: var(---border);
|
|
37
|
+
border-radius: 0.25rem;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.body ::slotted(*) {
|
|
41
|
+
margin: 0.625rem;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* HACK: Sibling selectors not working with ::slotted */
|
|
45
|
+
/* .body > rdk-task + sdt-response,
|
|
46
|
+
::slotted(rdk-task) + ::slotted(sdt-response) { */
|
|
47
|
+
/* .body ::slotted(sdt-response) {
|
|
48
|
+
margin-left: 0;
|
|
49
|
+
} */
|
|
50
|
+
|
|
51
|
+
/* HACK: Sibling selectors not working with ::slotted */
|
|
52
|
+
/* .body > sdt-control + rdk-task,
|
|
53
|
+
::slotted(sdt-control) + ::slotted(rdk-task) {
|
|
54
|
+
margin-left: 0;
|
|
55
|
+
} */
|
|
56
|
+
/* .body ::slotted(rdk-task) {
|
|
57
|
+
margin-left: 0;
|
|
58
|
+
} */
|
|
59
|
+
`,
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
render() { /* eslint-disable-line class-methods-use-this */
|
|
64
|
+
return html`
|
|
65
|
+
<div class="holder">
|
|
66
|
+
<div class="body">
|
|
67
|
+
<slot>Empty!</slot>
|
|
68
|
+
</div>
|
|
69
|
+
</div>`;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
customElements.define('htd-example', HTDExample);
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
|
|
2
|
+
// import HTDMath from '@decidables/discountable-math';
|
|
3
|
+
|
|
4
|
+
import HTDExample from './htd-example';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
HTDExampleHuman element
|
|
8
|
+
<htd-example-human>
|
|
9
|
+
*/
|
|
10
|
+
export default class HTDExampleHuman extends HTDExample {
|
|
11
|
+
firstUpdated(/* changedProperties */) {
|
|
12
|
+
this.discountableControl = this.querySelector('discountable-control');
|
|
13
|
+
this.itcTask = this.querySelector('itc-task');
|
|
14
|
+
this.discountableResponse = this.querySelector('discountable-response');
|
|
15
|
+
|
|
16
|
+
this.htdFit = this.querySelector('htd-fit');
|
|
17
|
+
this.htdCurves = this.querySelector('htd-curves');
|
|
18
|
+
|
|
19
|
+
if (this.discountableControl) {
|
|
20
|
+
if (this.discountableControl.hasAttribute('trials')) {
|
|
21
|
+
this.discountableControl.addEventListener('discountable-control-trials', (event) => {
|
|
22
|
+
if (this.itcTask) {
|
|
23
|
+
this.itcTask.trials = event.detail.trials;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (this.discountableResponse) {
|
|
27
|
+
this.discountableResponse.trialTotal = event.detail.trials;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (this.discountableControl.hasAttribute('duration')) {
|
|
33
|
+
this.discountableControl.addEventListener('discountable-control-duration', (event) => {
|
|
34
|
+
if (this.itcTask) {
|
|
35
|
+
this.itcTask.duration = event.detail.duration;
|
|
36
|
+
this.itcTask.iti = event.detail.duration;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (this.discountableControl.hasAttribute('run')) {
|
|
42
|
+
this.discountableControl.addEventListener('discountable-control-run', (/* event */) => {
|
|
43
|
+
if (this.itcTask) {
|
|
44
|
+
this.itcTask.running = true;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (this.discountableControl.hasAttribute('pause')) {
|
|
50
|
+
this.discountableControl.addEventListener('discountable-control-pause', (/* event */) => {
|
|
51
|
+
if (this.itcTask) {
|
|
52
|
+
this.itcTask.running = false;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (this.discountableControl.hasAttribute('reset')) {
|
|
58
|
+
this.discountableControl.addEventListener('discountable-control-reset', (/* event */) => {
|
|
59
|
+
if (this.itcTask) {
|
|
60
|
+
this.itcTask.reset();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (this.discountableResponse) {
|
|
64
|
+
this.discountableResponse.reset();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (this.htdFit) {
|
|
68
|
+
this.htdFit.clear();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (this.htdCurves) {
|
|
72
|
+
this.htdCurves.clearOptions();
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (this.itcTask) {
|
|
79
|
+
if (this.discountableResponse) {
|
|
80
|
+
this.discountableResponse.trialTotal = this.itcTask.trials;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
this.itcTask.addEventListener('itc-trial-start', (event) => {
|
|
84
|
+
if (this.discountableResponse) {
|
|
85
|
+
this.discountableResponse.start(
|
|
86
|
+
event.detail.as,
|
|
87
|
+
event.detail.ds,
|
|
88
|
+
event.detail.al,
|
|
89
|
+
event.detail.dl,
|
|
90
|
+
event.detail.trial,
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (this.htdCurves) {
|
|
95
|
+
this.htdCurves.setOption(
|
|
96
|
+
event.detail.as,
|
|
97
|
+
event.detail.ds,
|
|
98
|
+
'smaller-sooner',
|
|
99
|
+
's',
|
|
100
|
+
);
|
|
101
|
+
this.htdCurves.setOption(
|
|
102
|
+
event.detail.al,
|
|
103
|
+
event.detail.dl,
|
|
104
|
+
'larger-later',
|
|
105
|
+
'l',
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
this.itcTask.addEventListener('itc-trial-end', (/* event */) => {
|
|
111
|
+
if (this.discountableResponse) {
|
|
112
|
+
this.discountableResponse.stop();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (this.htdCurves) {
|
|
116
|
+
this.htdCurves.removeOption('smaller-sooner');
|
|
117
|
+
this.htdCurves.removeOption('larger-later');
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
this.itcTask.addEventListener('itc-block-end', (/* event */) => {
|
|
122
|
+
if (this.discountableControl) {
|
|
123
|
+
this.discountableControl.complete();
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (this.discountableResponse) {
|
|
129
|
+
this.discountableResponse.addEventListener('discountable-response', (event) => {
|
|
130
|
+
if (this.htdFit) {
|
|
131
|
+
this.htdFit.set(
|
|
132
|
+
event.detail.as,
|
|
133
|
+
event.detail.ds,
|
|
134
|
+
event.detail.al,
|
|
135
|
+
event.detail.dl,
|
|
136
|
+
event.detail.response,
|
|
137
|
+
event.detail.trial.toString(),
|
|
138
|
+
event.detail.trial.toString(),
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (this.htdFit) {
|
|
145
|
+
this.htdFit.addEventListener('htd-fit-update', (event) => {
|
|
146
|
+
if (this.htdCurves) {
|
|
147
|
+
this.htdCurves.k = event.detail.k;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
customElements.define('htd-example-human', HTDExampleHuman);
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
|
|
2
|
+
import HTDExample from './htd-example';
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
HTDExampleInteractive element
|
|
6
|
+
<htd-example-interactive>
|
|
7
|
+
*/
|
|
8
|
+
export default class HTDExampleInteractive extends HTDExample {
|
|
9
|
+
static get properties() {
|
|
10
|
+
return {
|
|
11
|
+
as: {
|
|
12
|
+
attribute: 'amount-ss',
|
|
13
|
+
type: Number,
|
|
14
|
+
reflect: true,
|
|
15
|
+
},
|
|
16
|
+
ds: {
|
|
17
|
+
attribute: 'delay-ss',
|
|
18
|
+
type: Number,
|
|
19
|
+
reflect: true,
|
|
20
|
+
},
|
|
21
|
+
al: {
|
|
22
|
+
attribute: 'amount-ll',
|
|
23
|
+
type: Number,
|
|
24
|
+
reflect: true,
|
|
25
|
+
},
|
|
26
|
+
dl: {
|
|
27
|
+
attribute: 'delay-ll',
|
|
28
|
+
type: Number,
|
|
29
|
+
reflect: true,
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
k: {
|
|
33
|
+
attribute: 'k',
|
|
34
|
+
type: Number,
|
|
35
|
+
reflect: true,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
constructor() {
|
|
41
|
+
super();
|
|
42
|
+
|
|
43
|
+
this.as = 10;
|
|
44
|
+
this.ds = 1;
|
|
45
|
+
this.al = 50;
|
|
46
|
+
this.dl = 40;
|
|
47
|
+
this.k = 0.05;
|
|
48
|
+
|
|
49
|
+
this.htdCalculation = null;
|
|
50
|
+
this.htdCurves = null;
|
|
51
|
+
this.itcChoice = null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
firstUpdated(/* changedProperties */) {
|
|
55
|
+
this.htdCalculation = this.querySelector('htd-calculation');
|
|
56
|
+
this.htdCurves = this.querySelector('htd-curves');
|
|
57
|
+
this.itcChoice = this.querySelector('itc-choice');
|
|
58
|
+
|
|
59
|
+
if (this.htdCalculation) {
|
|
60
|
+
this.htdCalculation.addEventListener('htd-calculation-change', (event) => {
|
|
61
|
+
this.as = event.detail.as;
|
|
62
|
+
this.ds = event.detail.ds;
|
|
63
|
+
this.al = event.detail.al;
|
|
64
|
+
this.dl = event.detail.dl;
|
|
65
|
+
|
|
66
|
+
this.k = event.detail.k;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (this.htdCurves) {
|
|
71
|
+
this.htdCurves.addEventListener('htd-curves-change', (event) => {
|
|
72
|
+
this.k = event.detail.k;
|
|
73
|
+
if (event.detail.name === 'default') {
|
|
74
|
+
this.as = event.detail.a;
|
|
75
|
+
this.ds = event.detail.d;
|
|
76
|
+
} else if (event.detail.name === 'larger-later') {
|
|
77
|
+
this.al = event.detail.a;
|
|
78
|
+
this.dl = event.detail.d;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (this.itcChoice) {
|
|
84
|
+
this.itcChoice.addEventListener('itc-choice-change', (event) => {
|
|
85
|
+
this.as = event.detail.as;
|
|
86
|
+
this.ds = event.detail.ds;
|
|
87
|
+
this.al = event.detail.al;
|
|
88
|
+
this.dl = event.detail.dl;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
this.requestUpdate();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
update(changedProperties) {
|
|
96
|
+
super.update(changedProperties);
|
|
97
|
+
|
|
98
|
+
if (this.htdCalculation) {
|
|
99
|
+
this.htdCalculation.as = this.as;
|
|
100
|
+
this.htdCalculation.ds = this.ds;
|
|
101
|
+
this.htdCalculation.al = this.al;
|
|
102
|
+
this.htdCalculation.dl = this.dl;
|
|
103
|
+
|
|
104
|
+
this.htdCalculation.k = this.k;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (this.htdCurves) {
|
|
108
|
+
this.htdCurves.setOption(this.as, this.ds, 'default', 's');
|
|
109
|
+
this.htdCurves.setOption(this.al, this.dl, 'larger-later', 'l');
|
|
110
|
+
|
|
111
|
+
this.htdCurves.k = this.k;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (this.itcChoice) {
|
|
115
|
+
this.itcChoice.as = this.as;
|
|
116
|
+
this.itcChoice.ds = this.ds;
|
|
117
|
+
this.itcChoice.al = this.al;
|
|
118
|
+
this.itcChoice.dl = this.dl;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
customElements.define('htd-example-interactive', HTDExampleInteractive);
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
|
|
2
|
+
import HTDMath from '@decidables/discountable-math';
|
|
3
|
+
|
|
4
|
+
import HTDExample from './htd-example';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
HTDExampleModel element
|
|
8
|
+
<htd-example-model>
|
|
9
|
+
*/
|
|
10
|
+
export default class HTDExampleModel extends HTDExample {
|
|
11
|
+
static get properties() {
|
|
12
|
+
return {
|
|
13
|
+
k: {
|
|
14
|
+
attribute: 'k',
|
|
15
|
+
type: Number,
|
|
16
|
+
reflect: true,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
|
|
24
|
+
this.k = 0.2;
|
|
25
|
+
|
|
26
|
+
this.discountableControl = null;
|
|
27
|
+
this.discountableResponse = null;
|
|
28
|
+
this.htdCalculation = null;
|
|
29
|
+
this.htdCurves = null;
|
|
30
|
+
this.itcTask = null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
firstUpdated(/* changedProperties */) {
|
|
34
|
+
this.discountableControl = this.querySelector('discountable-control');
|
|
35
|
+
this.discountableResponse = this.querySelector('discountable-response');
|
|
36
|
+
this.htdCalculation = this.querySelector('htd-calculation');
|
|
37
|
+
this.htdCurves = this.querySelector('htd-curves');
|
|
38
|
+
this.itcTask = this.querySelector('itc-task');
|
|
39
|
+
|
|
40
|
+
if (this.discountableControl) {
|
|
41
|
+
if (this.discountableControl.hasAttribute('trials')) {
|
|
42
|
+
this.discountableControl.addEventListener('discountable-control-trials', (event) => {
|
|
43
|
+
if (this.itcTask) {
|
|
44
|
+
this.itcTask.trials = event.detail.trials;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (this.discountableResponse) {
|
|
48
|
+
this.discountableResponse.trialTotal = event.detail.trials;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (this.discountableControl.hasAttribute('duration')) {
|
|
54
|
+
this.discountableControl.addEventListener('discountable-control-duration', (event) => {
|
|
55
|
+
if (this.itcTask) {
|
|
56
|
+
this.itcTask.duration = event.detail.duration;
|
|
57
|
+
this.itcTask.iti = event.detail.duration;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (this.discountableControl.hasAttribute('run')) {
|
|
63
|
+
this.discountableControl.addEventListener('discountable-control-run', (/* event */) => {
|
|
64
|
+
if (this.htdCurves) {
|
|
65
|
+
this.htdCurves.resumeTrial();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (this.itcTask) {
|
|
69
|
+
this.itcTask.running = true;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (this.discountableControl.hasAttribute('pause')) {
|
|
75
|
+
this.discountableControl.addEventListener('discountable-control-pause', (/* event */) => {
|
|
76
|
+
if (this.htdCurves) {
|
|
77
|
+
this.htdCurves.pauseTrial();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (this.itcTask) {
|
|
81
|
+
this.itcTask.running = false;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (this.discountableControl.hasAttribute('reset')) {
|
|
87
|
+
this.discountableControl.addEventListener('discountable-control-reset', (/* event */) => {
|
|
88
|
+
if (this.discountableResponse) {
|
|
89
|
+
this.discountableResponse.reset();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (this.htdCurves) {
|
|
93
|
+
this.htdCurves.clearOptions();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (this.itcTask) {
|
|
97
|
+
this.itcTask.reset();
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (this.htdCurves) {
|
|
104
|
+
this.htdCurves.addEventListener('htd-curves-change', (event) => {
|
|
105
|
+
this.k = event.detail.k;
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
this.htdCurves.addEventListener('discountable-response', (event) => {
|
|
109
|
+
if (this.discountableResponse) {
|
|
110
|
+
this.discountableResponse.responded(event.detail.response);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (this.itcTask) {
|
|
116
|
+
if (this.discountableResponse) {
|
|
117
|
+
this.discountableResponse.trialTotal = this.itcTask.trials;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
this.itcTask.addEventListener('itc-trial-start', (event) => {
|
|
121
|
+
if (this.discountableResponse) {
|
|
122
|
+
this.discountableResponse.start(
|
|
123
|
+
event.detail.as,
|
|
124
|
+
event.detail.ds,
|
|
125
|
+
event.detail.al,
|
|
126
|
+
event.detail.dl,
|
|
127
|
+
event.detail.trial,
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const vs = HTDMath.adk2v(event.detail.as, event.detail.ds, this.k);
|
|
132
|
+
const vl = HTDMath.adk2v(event.detail.al, event.detail.dl, this.k);
|
|
133
|
+
|
|
134
|
+
const response = (vs > vl)
|
|
135
|
+
? 'first'
|
|
136
|
+
: 'second';
|
|
137
|
+
|
|
138
|
+
if (this.htdCurves) {
|
|
139
|
+
this.htdCurves.trial(
|
|
140
|
+
event.detail.as,
|
|
141
|
+
event.detail.ds,
|
|
142
|
+
event.detail.al,
|
|
143
|
+
event.detail.dl,
|
|
144
|
+
event.detail.trial,
|
|
145
|
+
response,
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
this.itcTask.addEventListener('itc-trial-end', (/* event */) => {
|
|
151
|
+
if (this.discountableResponse) {
|
|
152
|
+
this.discountableResponse.stop();
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
this.itcTask.addEventListener('itc-block-end', (/* event */) => {
|
|
157
|
+
if (this.discountableControl) {
|
|
158
|
+
this.discountableControl.complete();
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
this.requestUpdate();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
update(changedProperties) {
|
|
167
|
+
super.update(changedProperties);
|
|
168
|
+
|
|
169
|
+
if (this.htdCalculation) {
|
|
170
|
+
this.htdCalculation.k = this.k;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (this.htdCurves) {
|
|
174
|
+
this.htdCurves.k = this.k;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
customElements.define('htd-example-model', HTDExampleModel);
|