Mark Schmidt wrote:

>2) Just read a little on services exposed through the ServiceManager.  Does
>this somehow provide the singleton access that I'm looking for?  Would I do
>a RegisterService in my embedded app and then a GetService in the JavaScript
>to get to it?
>
>Thanks for any info you can provide.
>-Mark
>
It should be possible to use services. A service is just a singleton 
XPCOM object. At startup you register its factory class and then an 
instance of the object will be created when first requested and reused 
thereafter.

See below for example of how to obtain a service in js:

http://lxr.mozilla.org/seamonkey/source/xpfe/components/filepicker/res/content/filepicker.js#192

And here is an embedding app which implements and registers that service

http://lxr.mozilla.org/seamonkey/source/embedding/browser/powerplant/source/CBrowserApp.cp#286
http://lxr.mozilla.org/seamonkey/source/embedding/browser/powerplant/source/PromptService.cpp

Adam


Reply via email to