Persistent Settings Update
Soon after I posted my persistent settings library, I received my first bug on it. I'll discuss the bug a bit, but first things first - the bug is fixed, and the links updated; if you previously downloaded the library, please go ahead and get the updated version.
Details:
The symptom of the bug was that the following two consecutive calls:
getPersistentSetting( "setting", firstCallback );
getPersistentSetting( "setting", secondCallback );
Would result in two calls on the 'secondCallback' function. The failure itself made it clear to me where the error was; and the location of the error suggested the fix. I'm afraid I don't know enough about the intricacies of the javascript language to know exactly why it failed in the first place, though; perhaps one of my more knowledgable readers will chime in.
Here is the failing code:
window.setTimeout(function ()
{
try
{
workItem.callback(returnValue);
}
catch (e)
{
persistentSettingLog("exception from callback: " + e.name + ": " + e.message);
}
}, 0);
And here is the fixed version:
persistentSettingScheduleCallback(workItem.callback, returnValue);
function persistentSettingScheduleCallback(callback, returnValue)
{
window.setTimeout(function ()
{
try
{
callback(returnValue);
}
catch (e)
{
persistentSettingLog("exception from callback: " + e.name + ": " + e.message);
}
}, 0);
}
Comments
Anonymous
October 09, 2006
In my earlier post , I talked about WPF in the Sidebar by using the IFRAME to host XBAPs. In this post,Anonymous
August 12, 2007
The comment has been removedAnonymous
August 12, 2007
Thinking about it some more, it would also be useful to have: System.Gadget.Settings.forcePersistence(variable, "persistent") and System.Gadget.Settings.forcePersistence(variable, "transitory") for those occasions where no matter a users preference a persistant variable is needed, or where there is no use for a persistent variable.Anonymous
October 27, 2008
PingBack from http://mstechnews.info/2008/10/persistent-settings-update/Anonymous
November 23, 2008
PingBack from http://www.sitewidget.net/2008/11/24/ping-vista-sidebar/Anonymous
November 23, 2008
PingBack from http://stereopropaganda.com/2008/11/23/ping-vista-sidebar/Anonymous
April 16, 2009
PingBack from http://www.sitewidget.net/2009/04/17/ping-vista-sidebar-2/