轻应用开发 API

app. setting

持久化配置,存储持久化配置信息,key-value格式

Methods

static clear()

清除所有配置

Example
app.setting.clear();

static get(name, defaultValue, callback)

获取配置信息

Parameters:
Name Type Description
name String

键名称

defaultValue String

默认值

callback function

回调函数

Example
app.setting.get("name","默认值",function(res){
      app.alert(res);
  });

static getAll(callback)

获取所有配置信息

Parameters:
Name Type Description
callback function

回调函数

Example
app.setting.getAll(function(res){
      app.alert(res);
  });

static remove(name)

删除某配置信息

Parameters:
Name Type Description
name String

Example
app.setting.remove("name");

static set(name, value)

持久化保存配置信息

Parameters:
Name Type Description
name String

value String

Example
app.setting.set("name", "lufeng");
          app.setting.set("sex","男");