fixes so both the firefox and chrome tests pass; firefox supports local storage, chrome also supports firebase storage

This commit is contained in:
Chris Karlof 2013-10-08 17:15:20 -07:00
Родитель eca1689803
Коммит c1e0ee8306
5 изменённых файлов: 25 добавлений и 8 удалений

Просмотреть файл

@ -29,8 +29,12 @@ var _Gombot = function(importedModules, Gombot) {
var Backbone = getModule("Backbone")();
var _ = getModule("_");
var BackboneFirebaseAdapter = getModule("BackboneFirebaseAdapter")(Backbone, _);
var Dropbox = getModule("Dropbox");
var BackboneFirebaseAdapter;
var Dropbox;
if (typeof window !== "undefined") { // skip on Firefox for now
Dropbox = getModule("Dropbox");
BackboneFirebaseAdapter = getModule("BackboneFirebaseAdapter")(Backbone, _);
}
var Q = getModule("Q");
var Libs = {
@ -101,11 +105,15 @@ var _Gombot = function(importedModules, Gombot) {
// and UserCollection don't need to be created inside this init function.
// Also maybe move the storage creation out of here
new Gombot.LocalSync(options.storeName || DEFAULT_STORE_NAME, function(store) {
Gombot.DropboxSyncStrategy = getModule("DropboxSync")(Libs);
Gombot.FirebaseSyncStrategy = getModule("FirebaseSync")(Backbone, _, options.firebaseStoreName || DEFAULT_STORE_NAME); // sync using firebase
Gombot.LocalSyncStrategy = store;
Gombot.SyncAdapter = getModule("SyncAdapter")(Gombot, Gombot.Crypto, Gombot.DropboxSyncStrategy, _);
//Gombot.SyncAdapter = getModule("SyncAdapter")(Gombot, Gombot.Crypto, Gombot.FirebaseSync, _);
if (typeof window !== "undefined") { // skip on Firefox for now
Gombot.DropboxSyncStrategy = getModule("DropboxSync")(Libs);
Gombot.FirebaseSyncStrategy = getModule("FirebaseSync")(Backbone, _, options.firebaseStoreName || DEFAULT_STORE_NAME); // sync using firebase
Gombot.SyncAdapter = getModule("SyncAdapter")(Gombot, Gombot.Crypto, Gombot.FirebaseSyncStrategy, _);
}
else {
Gombot.SyncAdapter = getModule("SyncAdapter")(Gombot, Gombot.Crypto, Gombot.LocalSyncStrategy, _);
}
Gombot.UserCollection = getModule("UserCollection")(Backbone, _, Gombot, store);
options.callback();
});

Просмотреть файл

@ -23,7 +23,8 @@ var GombotModules = {
AccountManager: require("./account_manager"),
Pages: require("./pages"),
GombotCrypto: require("./client/crypto"),
SyncAdapter: require("./sync/sync_adapter")
SyncAdapter: require("./sync/sync_adapter"),
Q: require("./lib/q.js")
};
module.exports = GombotModules;

Просмотреть файл

@ -24,6 +24,10 @@ var FirebaseSync = function(Backbone, _, firebaseStoreName) {
};
};
if (typeof module !== "undefined" && module.exports) {
module.exports = LocalSync;
}
// var authClient = new FirebaseAuthClient(dataRef, authClientCallback);
// chrome.webRequest.onBeforeSendHeaders.addListener(

Просмотреть файл

@ -295,3 +295,7 @@ Backbone.Firebase.Collection = Backbone.Collection.extend({
})();
};
if (typeof module !== "undefined" && module.exports) {
module.exports = BackboneFirebaseAdapter;
}

@ -1 +1 @@
Subproject commit 4fe6d2ae6e8c30237498e067f6ac91faaee65d2f
Subproject commit 081416b488a5e9f07893644c9b033d5b5a105d45