Skip to content

Commit d544573

Browse files
committed
Move more offlien sync logic to cb.offline
1 parent e9a679d commit d544573

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

src/addons/cb.offline/addon-built.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/addons/cb.offline/client.js

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
define([], function() {
22
var app = codebox.require("core/app");
3+
var box = codebox.require("core/box");
34
var menu = codebox.require("core/commands/menu");
45
var commands = codebox.require("core/commands/toolbar");
56
var hr = codebox.require("hr/hr");
@@ -64,5 +65,10 @@ define([], function() {
6465
setTimeout(function() {
6566
localfs.autoSync();
6667
}, 5*60*1000);
68+
69+
// Run sync everytime there is a modification
70+
box.on("box:watch", function() {
71+
localfs.autoSync();
72+
});
6773
});
6874

src/client/core/localfs.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,8 @@ define([
5050
* Init the localfs
5151
*/
5252
var initFs = function(baseDir) {
53-
var box = require("core/box");
54-
5553
base = "/"+baseDir;
56-
return Q().then(function() {
57-
// Box fs changes
58-
box.on("box:watch", function() {
59-
logger.warn("box change");
60-
autoSync();
61-
});
62-
});
54+
return Q();
6355
};
6456

6557
var prepareFs = function() {

0 commit comments

Comments
 (0)