From a15d4dc6a2c260412222074fd3bcfe864875deb3 Mon Sep 17 00:00:00 2001 From: HanishKVC Date: Fri, 31 May 2024 00:20:38 +0530 Subject: [PATCH] SimpleChat:ODS: Add a prefix to chatid wrt ondiskstorage key --- examples/server/public_simplechat/simplechat.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/server/public_simplechat/simplechat.js b/examples/server/public_simplechat/simplechat.js index 6b25b73bc..bfd048c5f 100644 --- a/examples/server/public_simplechat/simplechat.js +++ b/examples/server/public_simplechat/simplechat.js @@ -78,14 +78,18 @@ class SimpleChat { this.iLastSys = -1; } + ods_key() { + return `SimpleChat-${this.chatId}` + } + save() { /** @type {SimpleChatODS} */ let ods = {iLastSys: this.iLastSys, xchat: this.xchat}; - localStorage.setItem(this.chatId, JSON.stringify(ods)); + localStorage.setItem(this.ods_key(), JSON.stringify(ods)); } load() { - let sods = localStorage.getItem(this.chatId); + let sods = localStorage.getItem(this.ods_key()); if (sods == null) { return; }