From 888e954fd7b2f1cd2df0c3f806e2bd7c883ad6aa Mon Sep 17 00:00:00 2001 From: Tom Date: Thu, 5 Dec 2024 08:27:45 +0000 Subject: [PATCH] Fixed session data class. --- models/session.js | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/models/session.js b/models/session.js index a129cf6..c6212bc 100644 --- a/models/session.js +++ b/models/session.js @@ -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; } }