|
186 | 186 | if (src.startsWith("data:image")) {
|
187 | 187 | continue;
|
188 | 188 | }
|
| 189 | + |
| 190 | + if(window.chrome.webview === undefined) return; |
189 | 191 | //request the icon from the extension.
|
190 | 192 | var base64String = await window.chrome.webview.hostObjects.bridgeTwoWay.GetBase64StringFromPath(src);
|
191 | 193 | if (currentImage != null) {
|
|
195 | 197 | }
|
196 | 198 |
|
197 | 199 | function refreshLibraryView(libraryController) {
|
| 200 | + if(window.chrome.webview === undefined) return; |
198 | 201 | window.chrome.webview.postMessage("RefreshLibrary");
|
199 | 202 | }
|
200 | 203 |
|
|
203 | 206 | var encodedText = encodeURIComponent(text);
|
204 | 207 | //save the callback so we can access from our completion function
|
205 | 208 | searchCallback = callback;
|
| 209 | + if(window.chrome.webview === undefined) return; |
206 | 210 | window.chrome.webview.postMessage(JSON.stringify({"func":"performSearch","data":encodedText}));
|
207 | 211 | window.chrome.webview.postMessage(JSON.stringify({"func":"logEventsToInstrumentation","data":["Search",encodedText]}));
|
208 | 212 | }
|
209 | 213 |
|
210 | 214 | // Register event handlers for various events on library controller and package controller.
|
211 | 215 | libController.on(libController.ItemClickedEventName, function (nodeCreationName) {
|
212 | 216 | console.log('Library Node Clicked: ' + nodeCreationName);
|
| 217 | + if(window.chrome.webview === undefined) return; |
213 | 218 | window.chrome.webview.postMessage(JSON.stringify({"func":"createNode","data":nodeCreationName}));
|
214 | 219 | });
|
215 | 220 |
|
|
225 | 230 | }, true);
|
226 | 231 |
|
227 | 232 | libController.on(libController.ItemMouseEnterEventName, function (arg) {
|
| 233 | + if(window.chrome.webview === undefined) return; |
228 | 234 | window.chrome.webview.postMessage(JSON.stringify({"func":"showNodeTooltip","data":[arg.data,arg.rect.top]}));
|
229 | 235 | });
|
230 | 236 |
|
231 | 237 | libController.on(libController.ItemMouseLeaveEventName, function (arg) {
|
| 238 | + if(window.chrome.webview === undefined) return; |
232 | 239 | window.chrome.webview.postMessage(JSON.stringify({"func":"closeNodeTooltip","data":true}));
|
233 | 240 | });
|
234 | 241 |
|
235 | 242 | libController.on(libController.SectionIconClickedEventName, function (section) {
|
236 | 243 | console.log("Section clicked: " + section);
|
| 244 | + if(window.chrome.webview === undefined) return; |
237 | 245 | if (section == "Add-ons") {
|
238 | 246 | window.chrome.webview.postMessage(JSON.stringify({"func":"importLibrary","data":""}));
|
239 | 247 | }
|
|
245 | 253 | var catString = elem.name + ":" + (elem.checked ? "Selected" : "Unselected");
|
246 | 254 | categories.push(catString);
|
247 | 255 | });
|
| 256 | + if(window.chrome.webview === undefined) return; |
248 | 257 | window.chrome.webview.postMessage(JSON.stringify({"func":"logEventsToInstrumentation","data":["Filter-Categories",categories.join(",")]}));
|
249 | 258 | });
|
250 | 259 |
|
251 | 260 | //This will call the NextStep() function located in the LibraryViewController
|
252 | 261 | function nextStepInGuide() {
|
| 262 | + if(window.chrome.webview === undefined) return; |
253 | 263 | window.chrome.webview.postMessage(JSON.stringify({ "func": "NextStep", "data": "" }));
|
254 | 264 | }
|
255 | 265 |
|
|
436 | 446 |
|
437 | 447 | //This method will be executed when the WebBrowser change its size, so we can update the Popup vertical location that is over the library
|
438 | 448 | function bodyResizeEvent() {
|
| 449 | + if(window.chrome.webview === undefined) return; |
439 | 450 | window.chrome.webview.postMessage(JSON.stringify({ "func": "ResizedEvent", "data": "" }));
|
440 | 451 | }
|
441 | 452 |
|
|
0 commit comments