less annoyance on bug fix releases
This commit is contained in:
		
							
								
								
									
										9
									
								
								bg.js
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								bg.js
									
									
									
									
									
								
							@@ -1,7 +1,10 @@
 | 
			
		||||
browser.runtime.onInstalled.addListener((ev) => {
 | 
			
		||||
    if (ev.reason == "update") {
 | 
			
		||||
        launchInfoPage();
 | 
			
		||||
        // TODO determine how to launch the page only when there are important changes
 | 
			
		||||
        updateIsSignificant(ev.previousVersion).then(
 | 
			
		||||
            v => {
 | 
			
		||||
                if (v) launchInfoPage();
 | 
			
		||||
            }
 | 
			
		||||
        )
 | 
			
		||||
    } else if (ev.reason == "install") {
 | 
			
		||||
        browser.runtime.openOptionsPage()
 | 
			
		||||
    }
 | 
			
		||||
@@ -10,7 +13,7 @@ browser.runtime.onInstalled.addListener((ev) => {
 | 
			
		||||
async function updateIsSignificant(previousVersion) {
 | 
			
		||||
    const significantUpdates = ["0.1.0", "0.2.0", "0.3.0"];
 | 
			
		||||
    let currentVersion = (await browser.management.getSelf()).version;
 | 
			
		||||
    return currentVersion in significantUpdates;
 | 
			
		||||
    return (currentVersion in significantUpdates) || currentVersion.endsWith('0');
 | 
			
		||||
}
 | 
			
		||||
function launchInfoPage(){
 | 
			
		||||
    browser.tabs.create({url: "/changelog.htm", active: false})
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user