can update pointer state

This commit is contained in:
buzz-lightsnack-2007 2024-05-02 11:08:38 +08:00
parent ca1b5e152c
commit c2ad97d2ae

View file

@ -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]);
});
}
}
}