Saturday, October 12, 2013

Simple Preferences to Preferences/Service

This morning I switched over the weather widget to use the preferences/service module instead of the simple prefs. It works very well, and makes more of a difference than I had previously anticipated. When using simple preferences the constant updating combined with the listeners caused the widget to appear very glitchy. For instance, when hovering over an element it would almost "shake" as would any text fields. I believe this was the result of the asynchronous calls, that update the prefs, being delayed. Anyways, the preferences/service module has made it possible to have a clean onLoad function to load any preferences on installation or on startup. I tried doing the same with a "write to prefs" functionality in the exports.onUnload, but the asynchronous call to the content scripts to do so is delayed for too long. I simply made it save to the prefs on any city woeid change. This isn't as nice, but it will have to do.

No comments:

Post a Comment