Added JSDoc comments to src/main.js.
This commit is contained in:
Родитель
c2b09d8990
Коммит
f5eecece98
21
src/main.js
21
src/main.js
|
@ -10,6 +10,9 @@ const mezzuriteLoadCheckInterval = setInterval(
|
|||
|
||||
////////////////////////////////
|
||||
|
||||
/**
|
||||
* Creates the Mezzurite panel in the Chrome Developer Tools page.
|
||||
*/
|
||||
function createPanel() {
|
||||
const title = "Mezzurite";
|
||||
const iconPath = null;
|
||||
|
@ -19,11 +22,27 @@ function createPanel() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a callback function signature for handling the response that
|
||||
* is asynchronously returned by `chrome.devtools.inspectedWindow.eval()`.
|
||||
* @callback evalCallback
|
||||
* @param {Object} result - The result of the evaluated statement.
|
||||
* @param {Object} exceptionInfo - The exception details, if present.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Attempts to get the `window.mezzurite` object from the inspected window.
|
||||
* @param {evalCallback} callback - The callback that handles the response.
|
||||
*/
|
||||
function getMezzuriteObject(callback) {
|
||||
const expression = `window.mezzurite`;
|
||||
chrome.devtools.inspectedWindow.eval(expression, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the `Mezzurite` panel in the DevTools page if Mezzurite
|
||||
* is present on the inspected page.
|
||||
*/
|
||||
function createPanelIfMezzuriteLoaded() {
|
||||
if (isPanelCreated) {
|
||||
return;
|
||||
|
@ -34,6 +53,8 @@ function createPanelIfMezzuriteLoaded() {
|
|||
return; // Mezzurite not found
|
||||
}
|
||||
|
||||
console.log("Mezzurite was found!");
|
||||
|
||||
// Stop checking for Mezzurite every second, as we have found it.
|
||||
clearInterval(mezzuriteLoadCheckInterval);
|
||||
isPanelCreated = true;
|
||||
|
|
Загрузка…
Ссылка в новой задаче