services/sync/modules/main.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/services/sync/modules/main.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,29 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +this.EXPORTED_SYMBOLS = ['Weave'];
     1.9 +
    1.10 +this.Weave = {};
    1.11 +Components.utils.import("resource://services-sync/constants.js", Weave);
    1.12 +let lazies = {
    1.13 +  "jpakeclient.js":       ["JPAKEClient", "SendCredentialsController"],
    1.14 +  "notifications.js":     ["Notifications", "Notification", "NotificationButton"],
    1.15 +  "service.js":           ["Service"],
    1.16 +  "status.js":            ["Status"],
    1.17 +  "util.js":              ['Utils', 'Svc']
    1.18 +};
    1.19 +
    1.20 +function lazyImport(module, dest, props) {
    1.21 +  function getter(prop) function() {
    1.22 +    let ns = {};
    1.23 +    Components.utils.import(module, ns);
    1.24 +    delete dest[prop];
    1.25 +    return dest[prop] = ns[prop];
    1.26 +  };
    1.27 +  props.forEach(function(prop) dest.__defineGetter__(prop, getter(prop)));
    1.28 +}
    1.29 +
    1.30 +for (let mod in lazies) {
    1.31 +  lazyImport("resource://services-sync/" + mod, Weave, lazies[mod]);
    1.32 +}

mercurial