From c2ad97d2ae87a972654e11b1e147031bf97dcc08 Mon Sep 17 00:00:00 2001 From: buzz-lightsnack-2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Thu, 2 May 2024 11:08:38 +0800 Subject: [PATCH] can update pointer state --- scripts/data/pointer.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/data/pointer.js b/scripts/data/pointer.js index bba63f2..a8023af 100644 --- a/scripts/data/pointer.js +++ b/scripts/data/pointer.js @@ -3,7 +3,7 @@ Change the currently selected data to be viewed by the popup. */ -import {global} from "/scripts/secretariat.js"; +import {session} from "/scripts/secretariat.js"; class pointer { /* @@ -20,7 +20,21 @@ class pointer { } catch(err) {} // Get the last edited site. - return(global.write([`last`, `URL`], this.URL, -1)); + return(session.write([`last`, `URL`], this.URL)); + } + + /* + Update the state of the pointer. + + @param {dictionary} state the new state + */ + static update(state) { + // Indicate the status of the process. + if ((state && (typeof state).includes(`obj`)) ? Object.keys(state).length : false) { + (Object.keys(state)).forEach(async (key) => { + await session.write([`last`, key], state[key]); + }); + } } }