Skip to content

Commit

Permalink
Fixing DevTools Console Errors
Browse files Browse the repository at this point in the history
Fixing DevTools Console Errors
  • Loading branch information
RobertGlobant20 committed May 7, 2024
1 parent 5bd2f15 commit d2165d0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@
if (src.startsWith("data:image")) {
continue;
}

if(window.chrome.webview === undefined) return;
//request the icon from the extension.
var base64String = await window.chrome.webview.hostObjects.bridgeTwoWay.GetBase64StringFromPath(src);
if (currentImage != null) {
Expand All @@ -195,6 +197,7 @@
}

function refreshLibraryView(libraryController) {
if(window.chrome.webview === undefined) return;
window.chrome.webview.postMessage("RefreshLibrary");
}

Expand All @@ -203,13 +206,15 @@
var encodedText = encodeURIComponent(text);
//save the callback so we can access from our completion function
searchCallback = callback;
if(window.chrome.webview === undefined) return;
window.chrome.webview.postMessage(JSON.stringify({"func":"performSearch","data":encodedText}));
window.chrome.webview.postMessage(JSON.stringify({"func":"logEventsToInstrumentation","data":["Search",encodedText]}));
}

// Register event handlers for various events on library controller and package controller.
libController.on(libController.ItemClickedEventName, function (nodeCreationName) {
console.log('Library Node Clicked: ' + nodeCreationName);
if(window.chrome.webview === undefined) return;
window.chrome.webview.postMessage(JSON.stringify({"func":"createNode","data":nodeCreationName}));
});

Expand All @@ -225,15 +230,18 @@
}, true);

libController.on(libController.ItemMouseEnterEventName, function (arg) {
if(window.chrome.webview === undefined) return;
window.chrome.webview.postMessage(JSON.stringify({"func":"showNodeTooltip","data":[arg.data,arg.rect.top]}));
});

libController.on(libController.ItemMouseLeaveEventName, function (arg) {
if(window.chrome.webview === undefined) return;
window.chrome.webview.postMessage(JSON.stringify({"func":"closeNodeTooltip","data":true}));
});

libController.on(libController.SectionIconClickedEventName, function (section) {
console.log("Section clicked: " + section);
if(window.chrome.webview === undefined) return;
if (section == "Add-ons") {
window.chrome.webview.postMessage(JSON.stringify({"func":"importLibrary","data":""}));
}
Expand All @@ -245,11 +253,13 @@
var catString = elem.name + ":" + (elem.checked ? "Selected" : "Unselected");
categories.push(catString);
});
if(window.chrome.webview === undefined) return;
window.chrome.webview.postMessage(JSON.stringify({"func":"logEventsToInstrumentation","data":["Filter-Categories",categories.join(",")]}));
});

//This will call the NextStep() function located in the LibraryViewController
function nextStepInGuide() {
if(window.chrome.webview === undefined) return;
window.chrome.webview.postMessage(JSON.stringify({ "func": "NextStep", "data": "" }));
}

Expand Down Expand Up @@ -436,6 +446,7 @@

//This method will be executed when the WebBrowser change its size, so we can update the Popup vertical location that is over the library
function bodyResizeEvent() {
if(window.chrome.webview === undefined) return;
window.chrome.webview.postMessage(JSON.stringify({ "func": "ResizedEvent", "data": "" }));
}

Expand Down

0 comments on commit d2165d0

Please sign in to comment.