Skip to content

Commit

Permalink
Move more offlien sync logic to cb.offline
Browse files Browse the repository at this point in the history
  • Loading branch information
SamyPesse committed Dec 26, 2013
1 parent e9a679d commit d544573
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/addons/cb.offline/addon-built.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/addons/cb.offline/client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
define([], function() {
var app = codebox.require("core/app");
var box = codebox.require("core/box");
var menu = codebox.require("core/commands/menu");
var commands = codebox.require("core/commands/toolbar");
var hr = codebox.require("hr/hr");
Expand Down Expand Up @@ -64,5 +65,10 @@ define([], function() {
setTimeout(function() {
localfs.autoSync();
}, 5*60*1000);

// Run sync everytime there is a modification
box.on("box:watch", function() {
localfs.autoSync();
});
});

10 changes: 1 addition & 9 deletions src/client/core/localfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,8 @@ define([
* Init the localfs
*/
var initFs = function(baseDir) {
var box = require("core/box");

base = "/"+baseDir;
return Q().then(function() {
// Box fs changes
box.on("box:watch", function() {
logger.warn("box change");
autoSync();
});
});
return Q();
};

var prepareFs = function() {
Expand Down

0 comments on commit d544573

Please sign in to comment.