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 { class Session {
#id = null;
#started = null;
#current = null;
#lastScrobble = null;
#pauseDuration = 0;
constructor(id) { constructor(id) {
this._id = id; this.#id = id;
this._started = Date.now(); this.#started = Date.now();
this._current = null;
this._previous = null;
this._lastScrobble = null;
this._pauseDuration = 0;
} }
get id() { get id() {
return this._id; return this.#id;
} }
get playing() { get playing() {
return this._current; return this.#current;
} }
set playing(value) { set playing(value) {
this._current = value; console.log('playing =', value);
this.#current = value;
} }
get started() { get started() {
return this._started; return this.#started;
} }
get lastScrobbleTimestamp() { get lastScrobbleTimestamp() {
return this._lastScrobble; return this.#lastScrobble;
} }
set lastScrobbleTimestamp(value) { set lastScrobbleTimestamp(value) {
this._lastScrobble = value; this.#lastScrobble = value;
} }
get pauseDuration() { get pauseDuration() {
return this._pauseDuration; return this.#pauseDuration;
} }
set pauseDuration(value) { set pauseDuration(value) {
this._pauseDuration = value; this.#pauseDuration = value;
} }
} }