sunglasses 0.3

It was bugging my brother that settings didn’t persist between browser sessions, so I fixed this using localStorage in HTML5.  I’d tried to use localStorage when I first wrote the extension, but I mistakenly assumed that all the content scripts would get access to the localStorage that I used in my background script.

Since I couldn’t get it to work that way, I stored the settings in a variable in my background script and passed the value around with requests and listeners.  This time, all I had to do was convert each access to that particular variable in the background script to using localScript instead.  I also test for whether or not it is the first time the extension is run, and set a default darkness of 5% so that first time users can at least notice a difference when they install the extension.  Try it out and let me know what you think?

P.S. Forks, pull requests, feature requests welcome on the github page.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s