I would like to implement the observer pattern similar to Timer component. Instead of calling a callback by time expiration, the callbacks that are observers of a topic would be called from system events (like new file created, or a new e-mail received, etc.). I tried using nsIObserverService in the component XPCOM, but it seems that functions from component aren’t able to call observers in JavaScript by using NotifyObservers. The NotifyObservers only works when is called from JavaScript.
Thanks in advance
Example::Examplealways runs on the main thread (because it’s being created by your script). So it never creates a proxy to the observer service. But the call toExample::CallfromEx::Runhappens on the background thread, and I think in this case the call toNotifyObserversreturnsNS_ERROR_UNEXPECTED(which you ignore).