I have implemented an info button in my extension, where a red dot appears on the top right corner to alert users of new updates whenever they update the extension.
Currently, I achieve this by storing a row in localStorage when users view the updates. If this row is not found, the button displays the red dot. However, after every update, I need to manually alter code lines like:
//1.1.2 was the last version
localStorage.removeItem("update-1.1.2");
...
if( localStorage.getItem("update-1.1.3") === null ) {
//show button image with red dot
}
else {
//show button image without red dot
}
...
$('#info').click(function()
{
localStorage.setItem("update-1.1.3", "YES");
//swap the button image w/ red dot, with the same image w/o the red dot
});
It's a tedious process as I have to modify the "update-x.x.x" string at multiple places post every update.
This leads me to ask two questions: - Is there a more efficient way to handle this? Perhaps a method to automatically detect if a user has updated the extension? - Should I continue with image swapping or opt for displaying/hiding a red dot image instead? The performance difference might be negligible, but which approach is more optimal?