Skip to content

Errors thrown when user have slow loading time / slow connection #40

@Araxeus

Description

@Araxeus

function observeApp() {
debug(`Observing ${appName}...`);
appObserver = new MutationObserver((mutations, observer) => {
overrideVideoPause();
});
appObserver.observe(document.querySelector(appName), {
childList: true,
subtree: true
});
}

If using this extension with a bad loading time, you start to get errors that the "Node" is not defined in appObserver.observe.

Should probably check if it has loaded first, maybe something like this:

function setup() {
    if (document.querySelector(appName)) {
        observeApp();
        return;
    }

    const observer = new MutationObserver(() => {
        if (document.querySelector(appName)) {
            observer.disconnect();
            observeApp();
        }
    })

    observer.observe(document.documentElement, { childList: true, subtree: true });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions