Difference between revisions of "PWCore"

From CDOT Wiki
Jump to: navigation, search
(Registration)
(Registration)
Line 14: Line 14:
  
 
===Registration===
 
===Registration===
 +
 +
To register for PW notification with the Observer service you must create a class with a register function that contains the following code:
  
 
   var observerService = Components.classes["@mozilla.org/observer-service;1"]
 
   var observerService = Components.classes["@mozilla.org/observer-service;1"]
 
                                   .getService(Components.interfaces.nsIObserverService);
 
                                   .getService(Components.interfaces.nsIObserverService);
 
   observerService.addObserver(this, "experimental-notify-plugin-call", false);
 
   observerService.addObserver(this, "experimental-notify-plugin-call", false);

Revision as of 16:37, 24 April 2008

PW Core

Summery

PW Core is the core component of PluginWatcher, which resides at the plugin core of the Firefox browser. The intended purpose of PW Core is to time how long it takes plugins (such as Macromedia Flash, Windows Media Player, Acrobat Reader etc...) to execute their calls and then report the runtime (in milliseconds) using the Mozilla Observer service to anyone registered to receive PluginWatcher's notifications.

Release Information

PW Core is part of Mozilla 1.9 and will be released along with Firefox 3. If you are interested in seeing the code please visit this bug.

Usage

To make use of PW Core you must register to receive its runtime notifications using Mozilla's Observer service. To do this you need to know the notification's topic which is 'experimental-notify-plugin-call'. Below are a number of JavaScript snippets that would be useful to developers trying to work with PW Core:

Registration

To register for PW notification with the Observer service you must create a class with a register function that contains the following code:

 var observerService = Components.classes["@mozilla.org/observer-service;1"]
                                 .getService(Components.interfaces.nsIObserverService);
 observerService.addObserver(this, "experimental-notify-plugin-call", false);