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

Function tryUpdate

youtube-dynamic-grid/youtube-dynamic-grid.user.js:554–568  ·  view source on GitHub ↗

* Attempts to update the grid with retries. * @param {number} [attempts=CONFIG.RETRY_ATTEMPTS] - Retry attempts

(attempts = CONFIG.RETRY_ATTEMPTS)

Source from the content-addressed store, hash-verified

552 * @param {number} [attempts=CONFIG.RETRY_ATTEMPTS] - Retry attempts
553 */
554 tryUpdate(attempts = CONFIG.RETRY_ATTEMPTS) {
555 if (isPlaylistPage()) {
556 logger('Skipping grid update on playlist page')
557 this.removeCSS()
558 return
559 }
560 this.updateGrid()
561 if (
562 attempts > 0 &&
563 !document.querySelector('ytd-rich-grid-renderer:not([hidden])')
564 ) {
565 logger(`Retrying grid update (${attempts} attempts left)`, 'debug')
566 setTimeout(() => this.tryUpdate(attempts - 1), CONFIG.RETRY_INTERVAL)
567 }
568 },
569
570 /**
571 * Polls the grid for changes until stable.

Callers

nothing calls this directly

Calls 2

isPlaylistPageFunction · 0.85
loggerFunction · 0.85

Tested by

no test coverage detected