From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../api/navigator/mozsetmessagehandler/index.html | 252 +++++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 files/zh-cn/archive/b2g_os/api/navigator/mozsetmessagehandler/index.html (limited to 'files/zh-cn/archive/b2g_os/api/navigator/mozsetmessagehandler') 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 +--- +

+

此 API 在 Firefox OS网页内容或高权限的应用程序上可用。

+

+ +

概要

+ +

该方法用来允许应用为系统消息注册处理程序,对消息作出反应。

+ +

任何应用都允许注册到任何消息,但一些消息仅仅可以被送到有对应接收权限的应用。不同于DOM事件,如果应用没有针对系统消息的处理程序,它们将留在队列里。如果有排队消息,可以传入一个type参数调用navigator.mozHasPendingMessage()查看,当一个处理程序被设置,待处理消息将异步的地发送到应用。

+ +

语法

+ +
navigator.mozSetMessageHandler(type, handler);
+ +

参数

+ +
+
 
+
type
+
type是一个字符串,表示要为其注册处理函数的一类消息。
+
handler
+
当系统发送消息时,该处理函数被调用,其接收参数由消息类型来确定。
+
+ +

消息类型

+ +

目前Firefox OS允许注册以下消息 :

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Message nameHandler signaturePermission
activityf( MozActivityRequestHandler request ) 
alarmf( object unknown )alarms
bluetooth-cancelf( object unknown )bluetooth
bluetooth-dialer-commandf( object unknown )bluetooth
bluetooth-hfp-status-changedf( object unknown )bluetooth
bluetooth-opp-transfer-startf( object unknown )bluetooth
bluetooth-opp-transfer-completef( object unknown )bluetooth
bluetooth-opp-receiving-file-confirmationf( object unknown )bluetooth
bluetooth-opp-update-progressf( object unknown )bluetooth
bluetooth-pairedstatuschangedf( object unknown )bluetooth
bluetooth-requestconfirmationf( object unknown )bluetooth
bluetooth-requestpincodef( object unknown )bluetooth
bluetooth-requestpasskeyf( object unknown )bluetooth
headset-buttonf( object unknown ) 
icc-stkcommandf( object command )settings
notificationf( object unknown ) 
pushf( object registration )push
push-registerf (  )push
sms-receivedf( SmsMessage sms )sms
sms-sentf( SmsMessage sms )sms
telephony-call-endedf( object call )telephony
telephony-new-callf( )telephony
ussd-receivedf( object ussd )mobileconnection
wappush-receivedf( object wappush )wappush
+ +

规范说明

+ + + + + + + + + + + + + + +
SpecificationStatusComment
UnknownUnknownDefines the system messaging interfaces.
+ +

浏览器兼容性

+ +

We're converting our compatibility data into a machine-readable JSON format. + This compatibility table still uses the old format, + because we haven't yet converted the data it contains. + Find out how you can help!

+ +
+ + +

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support未实现未实现未实现未实现未实现
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox OSFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support未实现1.0未实现未实现未实现未实现
+
+ +

参见

+ + -- cgit v1.2.3-54-g00ecf