MCPcopy
hub / github.com/ChinaGodMan/UserScripts / waitForElement

Function waitForElement

tiktok-user-info/tiktok-user-info.user.js:522–529  ·  view source on GitHub ↗
(selector, callback)

Source from the content-addressed store, hash-verified

520 setInterval(checkProfileChange, 1000) // Interval for checking if user changed
521
522 function waitForElement(selector, callback) {
523 const el = document.querySelector(selector)
524 if (el) {
525 callback(el)
526 } else {
527 setTimeout(() => waitForElement(selector, callback), 500)
528 }
529 }
530
531 function downloadProfilePicture(url, username) {
532 const filename = `tiktok_profile_${username}_${Date.now()}.jpg`

Callers 1

Calls 1

callbackFunction · 0.85

Tested by

no test coverage detected