MCPcopy Create free account
hub / github.com/Surfer-Org/Protocol / checkElement

Function checkElement

desktop/src/main/preloadFunctions.js:26–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24 const startTime = Date.now();
25
26 const checkElement = () => {
27 const element = multipleElements
28 ? document.querySelectorAll(selector)
29 : document.querySelector(selector);
30 if (element) {
31 if (!multipleElements){
32 customConsoleLog(id, `Found ${elementName}`);
33 }
34 resolve(element);
35 } else if (Date.now() - startTime >= timeout) {
36 customConsoleLog(id, `Timeout waiting for ${elementName}`);
37 resolve(null);
38 } else {
39 setTimeout(checkElement, 100);
40 }
41 };
42
43 checkElement();
44 });

Callers 1

waitForElementFunction · 0.85

Calls 1

customConsoleLogFunction · 0.85

Tested by

no test coverage detected