This is the code for an example extension that I used in my blog post.
Please note that since it showcases a few different options, it's not runnable as-is. In background.js and extensionPage.js, you'd need to choose either Option 1, 2 or 3 and remove the others.