nsIMessageWakeupService 编辑
content/base/public/nsIMessageWakeupService.idl
Scriptable Implements the Message Manager wakeup service; this lets other components be woken up when specific Message Manager messages arrive. By using this service, you can avoid starting those components until they're needed. 1.0 66 Introduced Gecko 2.0 Inherits from: nsISupports
Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)Note: This service was introduced in Gecko 5.0 on Firefox for Android, but was not provided on desktop until Gecko 13.0 (Firefox 13). There is no IDL for this interface.
The parentprocessmessagemanager
is used for this, so messages send from childprocessmessagemanager
s will be heard.
Requesting wakeups
To request a wakeup, a wakeup condition must be registered with the category manager in the "wakeup-request" category. The easiest way to do this is to add the appropriate entry to the chrome manifest that registers your component (see category
in "Chrome registration").
To indicate a wakeup request in a manifest file, add a line that looks something like this:
category wakeup-request nsComponent @mozilla.org/myservice;1,nsIMyInterface,getService,myMessage1,myMessage2[,..]
The category entry value consists of a comma separate string that contains:
- The contract ID for your component (e.g. "
@mozilla.org/myservice;1
"). - The string name of interface to instantiate the component as (e.g. "
nsIMyInterface
"). - The method to call to instantiate the component (either "
getService
" or "createInstance
"). - A comma-separated list of messages for which your component should be instantiated.
Alternatively, it is possible to register a wakeup entry programmatically via the nsICategoryManager
interface.
Currently, services must expose a wrappedJSObject
in order to support this; however, once bug 593407 is fixed, the service to be woken up must implement nsIFrameMessageListener
.
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论