2014-09-04 23:44:00 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
this.EXPORTED_SYMBOLS = ["CloudSync"];
|
|
|
|
|
|
|
|
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
|
|
|
|
|
|
XPCOMUtils.defineLazyModuleGetter(this, "Adapters",
|
|
|
|
"resource://gre/modules/CloudSyncAdapters.jsm");
|
|
|
|
XPCOMUtils.defineLazyModuleGetter(this, "Local",
|
|
|
|
"resource://gre/modules/CloudSyncLocal.jsm");
|
|
|
|
XPCOMUtils.defineLazyModuleGetter(this, "Bookmarks",
|
|
|
|
"resource://gre/modules/CloudSyncBookmarks.jsm");
|
|
|
|
XPCOMUtils.defineLazyModuleGetter(this, "Tabs",
|
|
|
|
"resource://gre/modules/CloudSyncTabs.jsm");
|
|
|
|
|
2015-09-15 21:19:45 +03:00
|
|
|
var API_VERSION = 1;
|
2014-09-04 23:44:00 +04:00
|
|
|
|
2017-01-10 20:09:02 +03:00
|
|
|
var _CloudSync = function() {
|
2014-09-04 23:44:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
_CloudSync.prototype = {
|
|
|
|
_adapters: null,
|
|
|
|
|
2017-01-10 20:09:02 +03:00
|
|
|
get adapters() {
|
2014-09-04 23:44:00 +04:00
|
|
|
if (!this._adapters) {
|
|
|
|
this._adapters = new Adapters();
|
|
|
|
}
|
|
|
|
return this._adapters;
|
|
|
|
},
|
|
|
|
|
|
|
|
_bookmarks: null,
|
|
|
|
|
2017-01-10 20:09:02 +03:00
|
|
|
get bookmarks() {
|
2014-09-04 23:44:00 +04:00
|
|
|
if (!this._bookmarks) {
|
|
|
|
this._bookmarks = new Bookmarks();
|
|
|
|
}
|
|
|
|
return this._bookmarks;
|
|
|
|
},
|
|
|
|
|
|
|
|
_local: null,
|
|
|
|
|
2017-01-10 20:09:02 +03:00
|
|
|
get local() {
|
2014-09-04 23:44:00 +04:00
|
|
|
if (!this._local) {
|
|
|
|
this._local = new Local();
|
|
|
|
}
|
|
|
|
return this._local;
|
|
|
|
},
|
|
|
|
|
|
|
|
_tabs: null,
|
|
|
|
|
2017-01-10 20:09:02 +03:00
|
|
|
get tabs() {
|
2014-09-04 23:44:00 +04:00
|
|
|
if (!this._tabs) {
|
|
|
|
this._tabs = new Tabs();
|
|
|
|
}
|
|
|
|
return this._tabs;
|
|
|
|
},
|
|
|
|
|
2017-01-10 20:09:02 +03:00
|
|
|
get tabsReady() {
|
|
|
|
return this._tabs ? true : false;
|
2014-09-04 23:44:00 +04:00
|
|
|
},
|
|
|
|
|
2017-01-10 20:09:02 +03:00
|
|
|
get version() {
|
2014-09-04 23:44:00 +04:00
|
|
|
return API_VERSION;
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2017-01-10 20:09:02 +03:00
|
|
|
this.CloudSync = function CloudSync() {
|
2014-09-04 23:44:00 +04:00
|
|
|
return _cloudSyncInternal.instance;
|
|
|
|
};
|
|
|
|
|
|
|
|
Object.defineProperty(CloudSync, "ready", {
|
2017-01-10 20:09:02 +03:00
|
|
|
get() {
|
2014-09-04 23:44:00 +04:00
|
|
|
return _cloudSyncInternal.ready;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-09-15 21:19:45 +03:00
|
|
|
var _cloudSyncInternal = {
|
2014-09-04 23:44:00 +04:00
|
|
|
instance: null,
|
|
|
|
ready: false,
|
|
|
|
};
|
|
|
|
|
2017-01-10 20:09:02 +03:00
|
|
|
XPCOMUtils.defineLazyGetter(_cloudSyncInternal, "instance", function() {
|
2014-09-04 23:44:00 +04:00
|
|
|
_cloudSyncInternal.ready = true;
|
|
|
|
return new _CloudSync();
|
2017-01-10 20:09:02 +03:00
|
|
|
});
|