Changes

Jump to: navigation, search

CloudServices/Sync/FxSync/Developer/ClientAPI

502 bytes added, 22:17, 24 September 2010
Example
<pre>
function FooTracker(name) { Tracker.call(this, name);  // Register yourself as event listener or observer for whatever // you want to track. Note that this may unnecessarily slow down // things for users who don't use Sync. It's a bit smarter to have // yourself notified when to start and stop tracking therefore: Svc.Obs.add("weave:engine:start-tracking", this); Svc._initObs.add("weave:engine:stop-tracking", this);
}
FooTracker.prototype = {
__proto__: Tracker.prototype,
_logName: "FooTracker",
file: "foo",
_init _enabled: false, observe: function FooTracker_initobserve(subject, topic, data) { switch (topic) { case "weave:engine:start-tracking": if (!this._enabled) { // The ugly syntax on the next line calls the base class's init method:register event handler or observer here this .__proto__.__proto__._init this.call_enabled = true; } break; case "weave:engine:stop-tracking": if (this._enabled);{ //* Here is where you would register your tracker as an remove event handler or observer, so thathere ... this._enabled = false; its onEvent() (or other appropriately named) method can be called} in response to events. */break; },
onEvent: function FooTracker_onEvent() {
Canmove, confirm
725
edits

Navigation menu