27
edits
(→The Score: Trackers should not change the private _score property) |
(→Writing an Engine class: SyncEngine should be imported via main.js rather than directly. And exporting your engine is unnecessary.) |
||
Line 252: | Line 252: | ||
function FooEngine() { | function FooEngine() { | ||
SyncEngine.call(this, "Foo"); | Weave.SyncEngine.call(this, "Foo"); | ||
} | } | ||
FooEngine.prototype = { | FooEngine.prototype = { | ||
__proto__: SyncEngine.prototype, | __proto__: Weave.SyncEngine.prototype, | ||
_recordObj: FooRecord, | _recordObj: FooRecord, | ||
_storeObj: FooStore, | _storeObj: FooStore, | ||
Line 263: | Line 263: | ||
As you can see, there isn't actually any new code here at all; the prototype simply defines some metadata such as the Store and Tracker classes to use, and the human-readable name that will be used in the log files to identify errors and status messages coming from this engine. | As you can see, there isn't actually any new code here at all; the prototype simply defines some metadata such as the Store and Tracker classes to use, and the human-readable name that will be used in the log files to identify errors and status messages coming from this engine. | ||
(Don't forget that you'll need to import | (Don't forget that you'll need to import Weave. So the top of your file should include:) | ||
const Cu = Components.utils; | const Cu = Components.utils; | ||
// etc... | // etc... | ||
Cu.import("resource://services-sync/ | Cu.import("resource://services-sync/main.js"); | ||
== Installing your classes into Sync == | == Installing your classes into Sync == |
edits