Snippets

Merkulove Team Listener initialization delay of single page

Created by Dmitry Merkulov
const delayPageUrl = 'https://freshuk.co.il/%d7%a8%d7%a9%d7%99%d7%9e%d7%aa-%d7%a7%d7%a0%d7%99%d7%95%d7%aa/'; // Page URL to delay Listener init
const delayTimeout = 10000; // Delay in milliseconds

window.location.href === delayPageUrl ?
    setTimeout( bindInit, delayTimeout ) : document.addEventListener('DOMContentLoaded', bindInit );

/**
 * Fires when the initial HTML document has been completely loaded and parsed.
 **/
function bindInit() {

    document.querySelectorAll( targetSelectors ).forEach( item => {
        item.addEventListener( 'mouseup', elementMouseUp );
        item.addEventListener( 'focus', onFiledFocus );

        item.addEventListener( 'keypress', hideListener );
    } );

    if ( !! window.SpeechSDK ) {

        SpeechSDK = window.SpeechSDK;
        getAuthorizationToken();

    }

}

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.