feat: presenter view

- connected to websockets
- some styling changes
- reusable components
- some small bugfixes
This commit is contained in:
cv
2021-04-17 23:54:00 +02:00
parent d9a1b5eb20
commit 8e95b06b8c
11 changed files with 197 additions and 90 deletions
+5
View File
@@ -5,6 +5,7 @@
*/
class Timer {
clock = null;
duration = null;
current = null;
_finishAt = null;
@@ -21,6 +22,7 @@ class Timer {
setupWithSeconds(seconds, autoStart = false) {
// aux
const now = this._getCurrentTime();
this.clock = now;
// populate targets
this.duration = seconds * 1000;
@@ -43,6 +45,7 @@ class Timer {
update() {
// get current time
const now = this._getCurrentTime();
this.clock = now;
// check playstate
switch (this.state) {
@@ -101,7 +104,9 @@ class Timer {
this.update();
return {
clock: this.clock,
currentSeconds: Timer.toSeconds(this.current),
durationSeconds: Timer.toSeconds(this.duration),
expectedFinish: this._getExpectedFinish(),
startedAt: this._startedAt,
};