This API is available on Firefox OS for internal applications 仅。

摘要

This method is changes the value of one or more given settings.

This method is asynchronous and return a DOMRequest object which you use to detect when the change has been completed (or if an error occurs), and to act as needed once that's happened.

句法

SettingsLock.set(settings);
					

参数

settings
An object containing a set of key/value pairs where each key represents the string name of a given setting. The exact list of possible strings is device dependent. Each Gaia build can have its own list of settings. For an up-to-date list of those strings, take a look at the Gaia source code .

范例

This example turns on WiFi on the device.

var lock = navigator.mozSettings.createLock();
var result = lock.set({
  'wifi.enabled': true
});
result.onsuccess = function () {
  console.log("The setting has been changed");
}
result.onerror = function () {
  console.log("An error occure, the setting remain unchanged");
}
					

规范

Not part of any specification yet; however, this API will be discussed at W3C as part of the System Applications Working Group .

另请参阅

元数据

  • 最后修改: