aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/archive/b2g_os/api/settingslock
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/archive/b2g_os/api/settingslock
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/archive/b2g_os/api/settingslock')
-rw-r--r--files/zh-cn/archive/b2g_os/api/settingslock/index.html55
-rw-r--r--files/zh-cn/archive/b2g_os/api/settingslock/set/index.html80
2 files changed, 135 insertions, 0 deletions
diff --git a/files/zh-cn/archive/b2g_os/api/settingslock/index.html b/files/zh-cn/archive/b2g_os/api/settingslock/index.html
new file mode 100644
index 0000000000..50f05a7966
--- /dev/null
+++ b/files/zh-cn/archive/b2g_os/api/settingslock/index.html
@@ -0,0 +1,55 @@
+---
+title: SettingsLock
+slug: Archive/B2G_OS/API/SettingsLock
+tags:
+ - API
+ - B2G
+ - Firefox OS
+ - NeedsTranslation
+ - Non-standard
+ - Settings
+ - TopicStub
+translation_of: Archive/B2G_OS/API/SettingsLock
+---
+<section class="Quick_links" id="Quick_Links"><ol><li><strong><a href="/en-US/docs/Mozilla/Firefox_OS/API/Settings_API">Settings API</a></strong></li><li><strong><a href="/en-US/docs/Mozilla/Firefox_OS/API/Archive"><code>Archive</code></a></strong></li><li data-default-state="open"><a href="#"><strong>Events</strong></a><ol><li><a href="/en-US/docs/Web/Events/settingchange"><code>settingchange</code></a></li></ol></li><li data-default-state="open"><a href="#"><strong>Related pages for Settings API</strong></a><ol><li><a href="/en-US/docs/Mozilla/Firefox_OS/API/MozSettingsEvent"><code>MozSettingsEvent</code></a></li><li><a href="/en-US/docs/Mozilla/Firefox_OS/API/SettingsLock"><code>SettingsLock</code></a></li><li><a href="/en-US/docs/Mozilla/Firefox_OS/API/SettingsManager"><code>SettingsManager</code></a></li></ol></li></ol></section>
+
+<div class="warning">
+ <p style="text-align: center;">This API is available on <a href="/en-US/docs/Mozilla/Firefox_OS">Firefox OS</a> for <a href="/en-US/docs/Mozilla/Firefox_OS/Security/Application_security#App_Types">internal applications</a> only.</p>
+</div>
+
+<p>The <code><strong>SettingsLock</strong></code> interface represents a lock on settings. it allows a script to modify settings asynchronously, but in a safe way: ordering is guaranteed and the no other script will modify the settings until the modification are done (the next lock objects will start processing after it has been closed).</p>
+
+<p>Each call to <a href="/en-US/docs/Web/API/SettingsManager/createLock" title="The documentation about this has not yet been written; please consider contributing!"><code>SettingsManager.createLock()</code></a> create a new <code>SettingsLock</code> object.</p>
+
+<p>All <code>SettingsLock</code> objects are kept in a queue of active locks. When a <code>SettingsLock</code> object is created it's placed at the end of the queue. Calls to get/set places a request against the lock on which it's called. Requests run asynchronously and in the order they are placed against a lock. When the last request for a lock is run, and  the success/error event against it has been fired, the lock is removed from the queue and the next lock start to be processed.</p>
+
+<h2 id="Properties">Properties</h2>
+
+<dl>
+ <dt><a href="/en-US/docs/Web/API/SettingsLock/closed" title="The documentation about this has not yet been written; please consider contributing!"><code>SettingsLock.closed</code></a></dt>
+ <dd>Indicates if the lock is no longer the active lock (<code>true</code>) or if it's still the active lock (<code>false</code>)</dd>
+</dl>
+
+<h2 id="Methods">Methods</h2>
+
+<dl>
+ <dt><a href="/en-US/docs/Web/API/SettingsLock/set" title="The documentation about this has not yet been written; please consider contributing!"><code>SettingsLock.set()</code></a></dt>
+ <dd>Allows to change the values of a set of settings. This method is asychronous and return a <a href="/en-US/docs/Web/API/DOMRequest" title="The documentation about this has not yet been written; please consider contributing!"><code>DOMRequest</code></a> object.</dd>
+ <dt><a href="/en-US/docs/Web/API/SettingsLock/get" title="The documentation about this has not yet been written; please consider contributing!"><code>SettingsLock.get()</code></a></dt>
+ <dd>Allows to retrieve the value of a given setting. This method is asychronous and return a <a href="/en-US/docs/Web/API/DOMRequest" title="The documentation about this has not yet been written; please consider contributing!"><code>DOMRequest</code></a> object.</dd>
+ <dt><a href="/en-US/docs/Web/API/SettingsLock/clear" title="The documentation about this has not yet been written; please consider contributing!"><code>SettingsLock.clear()</code></a></dt>
+ <dd>Clears any action that have not been done yet (remember that <code>get</code> and <code>set</code> are asynchronous). This method is added for testing and it deletes the whole settings DB!</dd>
+</dl>
+
+<h2 id="Specification" name="Specification">Specification</h2>
+
+<p>Not part of any specification yet; however, this API will be discuss at W3C as part of the <a class="external" href="http://www.w3.org/2012/sysapps/" rel="external" title="http://www.w3.org/2012/sysapps/">System Applications Working Group</a>.</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/SettingsManager" title="The documentation about this has not yet been written; please consider contributing!"><code>SettingsManager</code></a></li>
+ <li><a href="/en-US/docs/Web/API/SettingsManager/createLock" title="The documentation about this has not yet been written; please consider contributing!"><code>SettingsManager.createLock()</code></a></li>
+ <li><a href="/en-US/docs/Web/API/Window/navigator/mozSettings" title="The documentation about this has not yet been written; please consider contributing!"><code>navigator.mozSettings</code></a></li>
+ <li><a href="/en-US/docs/WebAPI/Settings" title="/en-US/docs/WebAPI/Settings">Settings API</a></li>
+</ul>
diff --git a/files/zh-cn/archive/b2g_os/api/settingslock/set/index.html b/files/zh-cn/archive/b2g_os/api/settingslock/set/index.html
new file mode 100644
index 0000000000..2203fc1169
--- /dev/null
+++ b/files/zh-cn/archive/b2g_os/api/settingslock/set/index.html
@@ -0,0 +1,80 @@
+---
+title: SettingsLock.set()
+slug: Archive/B2G_OS/API/SettingsLock/set
+translation_of: Archive/B2G_OS/API/SettingsLock/set
+---
+<section class="Quick_links" id="Quick_Links">
+<ol>
+ <li><strong><a href="/en-US/docs/Mozilla/Firefox_OS/API/Settings_API">Settings API</a></strong></li>
+ <li><strong><a href="/en-US/docs/Mozilla/Firefox_OS/API/Archive"><code>Archive</code></a></strong></li>
+ <li data-default-state="open"><a href="#"><strong>Events</strong></a>
+ <ol>
+ <li><a href="/en-US/docs/Web/Events/settingchange"><code>settingchange</code></a></li>
+ </ol>
+ </li>
+ <li data-default-state="open"><a href="#"><strong>Related pages for Settings API</strong></a>
+ <ol>
+ <li><a href="/en-US/docs/Mozilla/Firefox_OS/API/MozSettingsEvent"><code>MozSettingsEvent</code></a></li>
+ <li><a href="/en-US/docs/Mozilla/Firefox_OS/API/SettingsLock"><code>SettingsLock</code></a></li>
+ <li><a href="/en-US/docs/Mozilla/Firefox_OS/API/SettingsManager"><code>SettingsManager</code></a></li>
+ </ol>
+ </li>
+</ol>
+</section>
+
+
+
+
+
+<div class="warning">
+<p style="text-align: center;">此API在 <a href="/en-US/docs/Mozilla/Firefox_OS">Firefox OS</a> 上仅可供 <a href="/en-US/docs/Mozilla/Firefox_OS/Security/Application_security#App_Types">内部程序 </a> 使用.</p>
+</div>
+
+
+
+<h2 id="摘要">摘要</h2>
+
+<p>这个方法用来更改一或多个已提供的设置的值。</p>
+
+<p>此方法是异步的,返回一个 <a href="/en-US/docs/Web/API/DOMRequest" title="The documentation about this has not yet been written; please consider contributing!"><code>DOMRequest</code></a> 对象,用于检测更改何时完成(或是否发生错误),并在更改完成后根据需要执行操作。</p>
+
+<h2 id="语法">语法</h2>
+
+<pre>SettingsLock.set(settings);</pre>
+
+<h3 id="参数">参数</h3>
+
+<dl>
+ <dt><code>settings</code></dt>
+ <dd>一个包含了一组键值对的对象,其中每个键表示给定的设置的字符串名称。可能的字符串的确切列表取决于设备。每个Gaia构建可以有自己的设置列表,有关这些字符串的最新列表,请查看 <a class="external" href="https://github.com/mozilla-b2g/gaia/blob/master/build/settings.py" rel="external" title="https://github.com/mozilla-b2g/gaia/blob/master/build/settings.py">the Gaia source code</a>.</dd>
+</dl>
+
+<h2 id="示例">示例</h2>
+
+<p>这个示例用来打开设备的WIFI。</p>
+
+<pre class="brush: js">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");
+}
+</pre>
+
+<h2 id="Specification" name="Specification">规范</h2>
+
+<p>这目前还不是任何规范的一部分; 然而, 此 API 将会作为 <a class="external" href="http://www.w3.org/2012/sysapps/" rel="external" title="http://www.w3.org/2012/sysapps/">System Applications Working Group</a> 的一部分参与W3C的讨论。</p>
+
+<h2 id="其他">其他</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/SettingsManager" title="The documentation about this has not yet been written; please consider contributing!"><code>SettingsManager</code></a></li>
+ <li><a href="/en-US/docs/Web/API/SettingsLock" title="The documentation about this has not yet been written; please consider contributing!"><code>SettingsLock</code></a></li>
+ <li><a href="/en-US/docs/WebAPI/Settings" title="/en-US/docs/WebAPI/Settings">Settings API</a></li>
+</ul>