Skip to content

Commit f5853c1

Browse files
Fixing DevTools Console Errors (#227)
* Fixing DevTools Console Errors Fixing DevTools Console Errors * Fixing DevTools Console Errors Bumping up librariejs version
1 parent ea43d0b commit f5853c1

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

index.html

+11
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@
186186
if (src.startsWith("data:image")) {
187187
continue;
188188
}
189+
190+
if(window.chrome.webview === undefined) return;
189191
//request the icon from the extension.
190192
var base64String = await window.chrome.webview.hostObjects.bridgeTwoWay.GetBase64StringFromPath(src);
191193
if (currentImage != null) {
@@ -195,6 +197,7 @@
195197
}
196198

197199
function refreshLibraryView(libraryController) {
200+
if(window.chrome.webview === undefined) return;
198201
window.chrome.webview.postMessage("RefreshLibrary");
199202
}
200203

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

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

@@ -225,15 +230,18 @@
225230
}, true);
226231

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

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

235242
libController.on(libController.SectionIconClickedEventName, function (section) {
236243
console.log("Section clicked: " + section);
244+
if(window.chrome.webview === undefined) return;
237245
if (section == "Add-ons") {
238246
window.chrome.webview.postMessage(JSON.stringify({"func":"importLibrary","data":""}));
239247
}
@@ -245,11 +253,13 @@
245253
var catString = elem.name + ":" + (elem.checked ? "Selected" : "Unselected");
246254
categories.push(catString);
247255
});
256+
if(window.chrome.webview === undefined) return;
248257
window.chrome.webview.postMessage(JSON.stringify({"func":"logEventsToInstrumentation","data":["Filter-Categories",categories.join(",")]}));
249258
});
250259

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

@@ -436,6 +446,7 @@
436446

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

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@dynamods/librariejs",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "Project that contains all hosted contents of Dynamo Windows client",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)