How to get/set the preference value?

■ Summary

If you want to save/load the small data, the preference is the good way.
For using the preference, developer should declare the preference at the config.xml.
/*******************************
*       config.xml Files
*******************************/

<preference name="test" value="1" readonly="false"/>



/*******************************
*       Javascript Files
*******************************/

// Get the preferences value
var value = widget.preferences.getItem("test"); 

// Set the preferences value
widget.preferences.setItem("test",2);

Responses

0 Replies