load/lonm-autosave-sessions.js
/**
     * Check if this is the most recent window, and if the most recent window is still open
     * if not, then stop saving the sessions
     */
Check if this is the most recent window, and if the most recent window is still open
if not, then stop saving the sessions
Check if this is the most recent window and if the most recent window is still open if not then stop saving the sessions
function triggerAutosave(){
        chrome.storage.local.get("LONM_SESSION_AUTOSAVE_LAST_WINDOW", data => {
            const lastOpenedWindow = data["LONM_SESSION_AUTOSAVE_LAST_WINDOW"];
            if(window.vivaldiWindowId===lastOpenedWindow){
                autoSaveSession();
                return;
            }
            chrome.windows.getAll(openWindows => {
                const foundLastOpen = openWindows.find(window => window.id===lastOpenedWindow);
                if(foundLastOpen){
                } else {
                    chrome.storage.local.set({
                        "LONM_SESSION_AUTOSAVE_LAST_WINDOW": window.vivaldiWindowId
                    }, () => {
                        autoSaveSession();
                    });
                }
            });
        });
    }
function triggerAutosave ( ) { chrome . storage . local . get ( "LONM_SESSION_AUTOSAVE_LAST_WINDOW" , data => { const lastOpenedWindow = data [ "LONM_SESSION_AUTOSAVE_LAST_WINDOW" ] ; if ( window . vivaldiWindowId === lastOpenedWindow ) { autoSaveSession ( ) ; return ; } chrome . windows . getAll ( openWindows => { const foundLastOpen = openWindows . find ( window => window . id === lastOpenedWindow ) ; if ( foundLastOpen ) { } else { chrome . storage . local . set ( { "LONM_SESSION_AUTOSAVE_LAST_WINDOW" : window . vivaldiWindowId } , ( ) => { autoSaveSession ( ) ; } ) ; } } ) ; } ) ; }
Check if this is the most recent window, and if the most recent window is still open
 if not, then stop saving the sessions
Check if this is the most recent window and if the most recent window is still open if not then stop saving the sessions
/* We know this window is correct, skip the checks */ /*Most recent window still active, use that one instead*/ /*Most recent window was closed, revert to this one*/