持久化配置,存储持久化配置信息,key-value格式
Methods
-
static clear()
-
清除所有配置
Example
app.setting.clear(); -
static get(name, defaultValue, callback)
-
获取配置信息
Parameters:
Name Type Description nameString 键名称
defaultValueString 默认值
callbackfunction 回调函数
Example
app.setting.get("name","默认值",function(res){ app.alert(res); }); -
static getAll(callback)
-
获取所有配置信息
Parameters:
Name Type Description callbackfunction 回调函数
Example
app.setting.getAll(function(res){ app.alert(res); }); -
static remove(name)
-
删除某配置信息
Parameters:
Name Type Description nameString 键
Example
app.setting.remove("name"); -
static set(name, value)
-
持久化保存配置信息
Parameters:
Name Type Description nameString 键
valueString 值
Example
app.setting.set("name", "lufeng"); app.setting.set("sex","男");