AnweshGangula / StackMeFirst

Highlight and sort answers posted by current user in Stack overflow to the top
https://stackapps.com/q/9515/96492
Other
3 stars 0 forks source link

notify user if settings are not saved when pop-up is closed #67

Open AnweshGangula opened 1 year ago

AnweshGangula commented 1 year ago

Right now, if the user make a change in settings and click on the chrome tab without clicking the save button, the settings don't get saved. You can use below code to notify user

Check out this link for reference: https://stackoverflow.com/a/65563521/6908282

// popup.js
chrome.runtime.connect({ name: "popup" });
// background.js
chrome.runtime.onConnect.addListener(function(port) {
    if (port.name === "popup") {
        port.onDisconnect.addListener(function() {
           console.log("popup has been closed")
        });
    }
});