aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/archive/b2g_os/api/navigator/mozsetmessagehandler
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/navigator/mozsetmessagehandler
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/navigator/mozsetmessagehandler')
-rw-r--r--files/zh-cn/archive/b2g_os/api/navigator/mozsetmessagehandler/index.html252
1 files changed, 252 insertions, 0 deletions
diff --git a/files/zh-cn/archive/b2g_os/api/navigator/mozsetmessagehandler/index.html b/files/zh-cn/archive/b2g_os/api/navigator/mozsetmessagehandler/index.html
new file mode 100644
index 0000000000..9418c598cc
--- /dev/null
+++ b/files/zh-cn/archive/b2g_os/api/navigator/mozsetmessagehandler/index.html
@@ -0,0 +1,252 @@
+---
+title: Navigator.mozSetMessageHandler()
+slug: Archive/B2G_OS/API/Navigator/mozSetMessageHandler
+translation_of: Archive/B2G_OS/API/Navigator/mozSetMessageHandler
+---
+<p></p><section class="Quick_links" id="Quick_Links"><ol><li><strong><a href="/zh-CN/docs/Web/API/Archive"><code>Archive</code></a></strong></li><li class="toggle"><details open><summary>Related pages for Firefox OS</summary><ol><li><a href="/zh-CN/docs/Web/API/MozAlarmsManager"><code>MozAlarmsManager</code></a></li><li><a href="/zh-CN/docs/Web/API/MozMobileNetworkInfo"><code>MozMobileNetworkInfo</code></a></li><li><a href="/zh-CN/docs/Web/API/MozWifiP2pGroupOwner"><code>MozWifiP2pGroupOwner</code></a></li></ol></details></li></ol></section><div class="warning">
+ <p style="text-align: center;">此 API 在 <a href="/zh-CN/docs/Mozilla/Firefox_OS">Firefox OS</a> 的<a href="/zh-CN/docs/Mozilla/Firefox_OS/Security/Application_security#App_Types">网页内容或高权限的应用程序</a>上可用。</p>
+</div><p></p>
+
+<h2 id="概要">概要</h2>
+
+<p>该方法用来允许应用为系统消息注册处理程序,对消息作出反应。</p>
+
+<p>任何应用都允许注册到任何消息,但一些消息仅仅可以被送到有对应接收权限的应用。不同于DOM事件,如果应用没有针对系统消息的处理程序,它们将留在队列里。如果有排队消息,可以传入一个type参数调用<a href="/zh-CN/docs/Web/API/Window/navigator/mozHasPendingMessage" title="此页面仍未被本地化, 期待您的翻译!"><code>navigator.mozHasPendingMessage()</code></a>查看,当一个处理程序被设置,待处理消息将异步的地发送到应用。</p>
+
+<h2 id="语法">语法</h2>
+
+<pre>navigator.mozSetMessageHandler(type, handler);</pre>
+
+<h3 id="参数">参数<span id="cke_bm_102S" style="display: none;"> </span></h3>
+
+<dl>
+ <dt> </dt>
+ <dt><code><span id="cke_bm_83S" style="display: none;"> </span>type</code></dt>
+ <dd>type是一个字符串,表示要为其注册处理函数的一类消息。</dd>
+ <dt><code>handler</code></dt>
+ <dd>当系统发送消息时,该处理函数被调用,其接收参数由消息类型来确定。</dd>
+</dl>
+
+<h2 id="Specification" name="Specification">消息类型</h2>
+
+<p>目前Firefox OS允许注册以下消息 :</p>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Message name</th>
+ <th scope="col">Handler signature</th>
+ <th scope="col">Permission</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>activity</code></td>
+ <td><code>f( <a href="/zh-CN/docs/Web/API/MozActivityRequestHandler" title="此页面仍未被本地化, 期待您的翻译!"><code>MozActivityRequestHandler</code></a> request )</code></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><code>alarm</code></td>
+ <td><code>f( object unknown )</code></td>
+ <td>alarms</td>
+ </tr>
+ <tr>
+ <td><code>bluetooth-cancel</code></td>
+ <td><code>f( object unknown )</code></td>
+ <td>bluetooth</td>
+ </tr>
+ <tr>
+ <td><code>bluetooth-dialer-command</code></td>
+ <td><code>f( object unknown )</code></td>
+ <td>bluetooth</td>
+ </tr>
+ <tr>
+ <td><code>bluetooth-hfp-status-changed</code></td>
+ <td><code>f( object unknown )</code></td>
+ <td>bluetooth</td>
+ </tr>
+ <tr>
+ <td><code>bluetooth-opp-transfer-start</code></td>
+ <td><code>f( object unknown )</code></td>
+ <td>bluetooth</td>
+ </tr>
+ <tr>
+ <td><code>bluetooth-opp-transfer-complete</code></td>
+ <td><code>f( object unknown )</code></td>
+ <td>bluetooth</td>
+ </tr>
+ <tr>
+ <td><code>bluetooth-opp-receiving-file-confirmation</code></td>
+ <td><code>f( object unknown )</code></td>
+ <td>bluetooth</td>
+ </tr>
+ <tr>
+ <td><code>bluetooth-opp-update-progress</code></td>
+ <td><code>f( object unknown )</code></td>
+ <td>bluetooth</td>
+ </tr>
+ <tr>
+ <td><code>bluetooth-pairedstatuschanged</code></td>
+ <td><code>f( object unknown )</code></td>
+ <td>bluetooth</td>
+ </tr>
+ <tr>
+ <td><code>bluetooth-requestconfirmation</code></td>
+ <td><code>f( object unknown )</code></td>
+ <td>bluetooth</td>
+ </tr>
+ <tr>
+ <td><code>bluetooth-requestpincode</code></td>
+ <td><code>f( object unknown )</code></td>
+ <td>bluetooth</td>
+ </tr>
+ <tr>
+ <td><code>bluetooth-requestpasskey</code></td>
+ <td><code>f( object unknown )</code></td>
+ <td>bluetooth</td>
+ </tr>
+ <tr>
+ <td><code>headset-button</code></td>
+ <td><code>f( object unknown )</code></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><code>icc-stkcommand</code></td>
+ <td><code>f( object command )</code></td>
+ <td>settings</td>
+ </tr>
+ <tr>
+ <td><code>notification</code></td>
+ <td><code>f( object unknown )</code></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><code>push</code></td>
+ <td><code>f( object <a href="/en-US/docs/WebAPI/Simple_Push#Add_the_push_message_handler">registration</a> )</code></td>
+ <td><code>push</code></td>
+ </tr>
+ <tr>
+ <td><code>push-register</code></td>
+ <td><code>f (  )</code></td>
+ <td><code>push</code></td>
+ </tr>
+ <tr>
+ <td><code>sms-received</code></td>
+ <td><code>f( <a href="/zh-CN/docs/Web/API/SmsMessage" title="此页面仍未被本地化, 期待您的翻译!"><code>SmsMessage</code></a> sms )</code></td>
+ <td style="white-space: nowrap;">sms</td>
+ </tr>
+ <tr>
+ <td><code>sms-sent</code></td>
+ <td><code>f( <a href="/zh-CN/docs/Web/API/SmsMessage" title="此页面仍未被本地化, 期待您的翻译!"><code>SmsMessage</code></a> sms )</code></td>
+ <td>sms</td>
+ </tr>
+ <tr>
+ <td><code>telephony-call-ended</code></td>
+ <td><code>f( object call )</code></td>
+ <td>telephony</td>
+ </tr>
+ <tr>
+ <td><code>telephony-new-call</code></td>
+ <td><code>f( )</code></td>
+ <td>telephony</td>
+ </tr>
+ <tr>
+ <td><code>ussd-received</code></td>
+ <td><code>f( object ussd )</code></td>
+ <td>mobileconnection</td>
+ </tr>
+ <tr>
+ <td><code>wappush-received</code></td>
+ <td><code>f( object wappush )</code></td>
+ <td>wappush</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="规范说明">规范说明</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td><a class="external" hreflang="en" lang="en" title="Unknown">Unknown</a></td>
+ <td><span class="spec-">Unknown</span></td>
+ <td>Defines the system messaging interfaces.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p></p><p class="warning"><strong><a href="https://github.com/mdn/browser-compat-data">We're converting our compatibility data into a machine-readable JSON format</a></strong>.
+ This compatibility table still uses the old format,
+ because we haven't yet converted the data it contains.
+ <strong><a href="/zh-CN/docs/MDN/Contribute/Structures/Compatibility_tables">Find out how you can help!</a></strong></p>
+
+<div class="htab">
+ <a id="AutoCompatibilityTable" name="AutoCompatibilityTable"></a>
+ <ul>
+ <li class="selected"><a>Desktop</a></li>
+ <li><a>Mobile</a></li>
+ </ul>
+</div><p></p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td><span style="color: #f00;">未实现</span></td>
+ <td><span style="color: #f00;">未实现</span></td>
+ <td><span style="color: #f00;">未实现</span></td>
+ <td><span style="color: #f00;">未实现</span></td>
+ <td><span style="color: #f00;">未实现</span></td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Firefox OS</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td><span style="color: #f00;">未实现</span></td>
+ <td>1.0</td>
+ <td><span style="color: #f00;">未实现</span></td>
+ <td><span style="color: #f00;">未实现</span></td>
+ <td><span style="color: #f00;">未实现</span></td>
+ <td><span style="color: #f00;">未实现</span></td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li><a href="/zh-CN/docs/Web/API/Window/navigator/mozHasPendingMessage" title="此页面仍未被本地化, 期待您的翻译!"><code>navigator.mozHasPendingMessage()</code></a></li>
+ <li><a href="/en-US/docs/WebAPI/Web_Activities" title="/en-US/docs/WebAPI/Web_Activities">Web Activities</a></li>
+ <li><a href="https://groups.google.com/forum/?fromgroups=#!topic/mozilla.dev.webapi/o8bkwx0EtmM" title="https://groups.google.com/forum/?fromgroups=#!topic/mozilla.dev.webapi/o8bkwx0EtmM">Discussion on the Mozilla WebAPI mailing list.</a></li>
+</ul>