Skip to content

Commit

Permalink
Bug fix (corrected some issues related to last commit)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Francisco committed May 19, 2011
1 parent 377030e commit b7ce6bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 2 additions & 7 deletions public/javascripts/backbone/server.push.js
@@ -1,4 +1,3 @@
var synced = false;
var auto_sync = false;

$(function() {
Expand All @@ -8,12 +7,8 @@ $(function() {
var faye = new Faye.Client('http://localhost:9292/faye');
auto_sync = true;
faye.subscribe('/sync', function(data) {
if (synced) {
synced = false;
} else if (data === 'ping') {
save(function() {
synced = true;

if (data === 'ping') {
db.save(function() {
var items = new App.Collections.Items();
items.fetch({
success: function() {
Expand Down
4 changes: 2 additions & 2 deletions public/javascripts/backbone/sync.js
Expand Up @@ -110,7 +110,7 @@ db = {
if (using_localstorage)
console.log("All data loaded from localStorage!");
if (window.navigator.onLine && !dontSync) {
sync(callback); // Sync to server
db.sync(callback); // Sync to server
} else {
callback();
}
Expand All @@ -122,7 +122,7 @@ db = {
if (using_localstorage)
console.log("All data saved to localStorage!");
if (window.navigator.onLine && !dontSync) {
sync(callback, item); // Sync to server
db.sync(callback, item); // Sync to server
} else {
persistence.flush(); // Flush the new changes
callback();
Expand Down

0 comments on commit b7ce6bd

Please sign in to comment.