Skip to content

Commit

Permalink
Add rounds-count
Browse files Browse the repository at this point in the history
  • Loading branch information
baruchiro committed Nov 23, 2020
1 parent f89ddd5 commit 94fec56
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ You can look on the `docs/index.html` file (also available in Github Pages [here
- `component-radius` The radius of the circle bounded by a square. The square is the component size. Default: `"100px"`.
- `dot-radius` The radius of the rotor. Default: `"40px"`.
- `circle-time` The number of seconds to complete a round. Default: `"10"`.
- `rounds-count` The amount of turns until the stop. Default: `"1"`.
- `red-alert` Show **red** alert when the user mouse is **out** the rotor. Default: `"true"`
- `green-alert` Show **green** alert when the user mouse is **in** the rotor. Default: `"true"`
- `timer` Count down seconds before the experiment start. Default: `"0"`. (If the value is `0`, the experiment will start when the user on the rotor)
Expand Down
1 change: 1 addition & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
component-radius="100px"
dot-radius="40px"
circle-time="6"
rounds-count="3"
green-alert="true"
red-alert="true"
timer="5"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pursuit-rotor-task",
"version": "0.1.0",
"version": "0.2.0",
"description": "Web Component for Pursuit Rotor Task to embed in web application",
"main": "src/PursuitRotorTask.js",
"repository": "https://github.com/baruchiro/pursuit-rotor-task.git",
Expand Down
9 changes: 8 additions & 1 deletion src/PursuitRotorTask.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class PursuitRotorTask extends HTMLElement {

static circleTime = "circle-time";
static roundsCount = "rounds-count";
static componentR = "component-radius";
static dotR = "dot-radius";
static redAlert = 'red-alert';
Expand All @@ -22,6 +23,12 @@ class PursuitRotorTask extends HTMLElement {
convert: parseInt,
proprty: true
},
[PursuitRotorTask.roundsCount]: {
default: "1",

convert: parseInt,
proprty: true
},
[PursuitRotorTask.redAlert]: {
default: true,
convert: (v) => 'true' === v,
Expand Down Expand Up @@ -175,7 +182,7 @@ class PursuitRotorTask extends HTMLElement {
if (!this.experienceTimeout) {
this.experienceTimeout = setTimeout(
this.onFinish,
this[PursuitRotorTask.circleTime] * 1000
this[PursuitRotorTask.circleTime] * 1000 * this[PursuitRotorTask.roundsCount]
);
}
}
Expand Down

0 comments on commit 94fec56

Please sign in to comment.