|
|
Line 260: |
Line 260: |
| Cu.import("resource://services-sync/engines.js"); | | Cu.import("resource://services-sync/engines.js"); |
|
| |
|
| == Installing your classes into Weave == | | == Installing your classes into Sync == |
|
| |
|
| [TODO describe where to put all your code and how to make it into importable modules]
| | You can register your engine in an ""weave:service:ready" observer using the Weave.Engines.register function. Note that the parameter you passed should be the name of your engine, such as Weave.Engines.register(FooEngine) and not new FooEngine(). |
| | |
| In the file <tt>weave/chrome/content/fx-weave-overlay.js</tt>, find the function <tt>FxWeaveGlue()</tt>, and within the <tt>try</tt> block import your Engine class, instantiate it, and register it with Weave. Like so:
| |
| | |
| <pre>
| |
| function FxWeaveGlue() {
| |
| //... etc ...
| |
| try {
| |
| Cu.import("resource://weave/engines/bookmarks.js");
| |
| Weave.Engines.register(new BookmarksEngine());
| |
| | |
| Cu.import("resource://weave/engines/history.js");
| |
| Weave.Engines.register(new HistoryEngine());
| |
| | |
| //.. etc ...
| |
| | |
| // Your engine here:
| |
| Cu.import("resource://weave/engines/foo.js");
| |
| Weave.Engines.register(new FooEngine());
| |
| | |
| } catch (e) {
| |
| //... etc ...
| |
| // In the latest Weave, You can register your engine in anywhere that you
| |
| // can access the Weave.Engines.register function. Please be noted that the
| |
| // parameter you passed should be the name of your engine, such as
| |
| // Weave.Engines.register(FooEngine), but not new FooEngine().
| |
| </pre>
| |
| | |
| To make your engine work in Fennec, you must also add the same code to the function <tt>FennecWeaveGlue()</tt> in the file <tt>weave/chrome/content/fennec-weave-overlay.js</tt>.
| |
|
| |
|
| == Updating the Weave preferences screen == | | == Updating the Weave preferences screen == |