Fixed session data class.

This commit is contained in:
Tom 2024-12-05 08:27:45 +00:00
parent b621527495
commit 888e954fd7

View File

@ -1,43 +1,46 @@
class Session {
#id = null;
#started = null;
#current = null;
#lastScrobble = null;
#pauseDuration = 0;
constructor(id) {
this._id = id;
this._started = Date.now();
this._current = null;
this._previous = null;
this._lastScrobble = null;
this._pauseDuration = 0;
this.#id = id;
this.#started = Date.now();
}
get id() {
return this._id;
return this.#id;
}
get playing() {
return this._current;
return this.#current;
}
set playing(value) {
this._current = value;
console.log('playing =', value);
this.#current = value;
}
get started() {
return this._started;
return this.#started;
}
get lastScrobbleTimestamp() {
return this._lastScrobble;
return this.#lastScrobble;
}
set lastScrobbleTimestamp(value) {
this._lastScrobble = value;
this.#lastScrobble = value;
}
get pauseDuration() {
return this._pauseDuration;
return this.#pauseDuration;
}
set pauseDuration(value) {
this._pauseDuration = value;
this.#pauseDuration = value;
}
}