hi,

i've copied a code from a website that deals with observers. The
problem is that it doesn't work. Someone could tell me where is the
problem?

thanks

here is the code :


function myObserver()
{
        this.register();
}



myObserver.prototype =
{
  observe: function(subject, topic, data)
  {
     alert("event detected...");
  },

  register: function()
  {
    try
    {
        var observerService =
Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
        observerService.notifyObservers(this, "accessible-event", null);
    }
    catch(e)
    {
        alert("myObserver-->register: "+e);
    }
  },

  unregister: function()
  {
        var observerService =
Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
    observerService.removeObserver(this, "accessible-event");
  }
}

_______________________________________________
Mozilla-xpcom mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to