From eaaeba79b14b0e5845094de34f6f7aaa50cf5bc0 Mon Sep 17 00:00:00 2001 From: buzz-lightsnack-2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Mon, 22 Apr 2024 16:43:20 +0800 Subject: [PATCH] provide tracking for the window Might be useful when opening a built-in page. --- scripts/GUI/windowman.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/GUI/windowman.js b/scripts/GUI/windowman.js index f3a5d56..171d89a 100644 --- a/scripts/GUI/windowman.js +++ b/scripts/GUI/windowman.js @@ -10,7 +10,7 @@ export default class windowman { } // Prepare the window with its metadata. - constructor() { + constructor(OPTIONS = {}) { function headers() { let LOAD_STATE = true; let UI = { @@ -244,11 +244,21 @@ export default class windowman { actions(); } + ((OPTIONS != null && (typeof OPTIONS).includes(`obj`) && !Array.isArray(OPTIONS)) ? OPTIONS[`monitor`] : true) ? this.monitor() : null; + headers(); appearance(); events(); } + /* Send monitoring events, useful to determining whether the window is opened or closed. + + @param {string} MESSAGE_NAME Custom message name + */ + monitor() { + chrome.runtime.connect({name: `view=${window.location.href}`}); + }; + /* Run this function if you would like to synchronize with data. */ async sync() { // Import the module.