indexeddb implementation, #15

This commit is contained in:
Mo Bitar
2017-01-11 17:50:47 -06:00
parent 7459df9b5a
commit 3ffc9ee667
9 changed files with 600 additions and 281 deletions

View File

@@ -1,6 +1,11 @@
class BaseCtrl {
constructor($rootScope, modelManager, apiController) {
constructor($rootScope, modelManager, apiController, dbManager) {
apiController.getCurrentUser(function(){});
dbManager.openDatabase(null, function(){
// new database, delete syncToken so that items can be refetched entirely from server
apiController.clearSyncToken();
apiController.sync();
})
}
}

View File

@@ -2,18 +2,21 @@ angular.module('app.frontend')
.controller('HomeCtrl', function ($scope, $rootScope, $timeout, apiController, modelManager) {
$rootScope.bodyClass = "app-body-class";
apiController.loadLocalItems();
apiController.loadLocalItems(function(items){
$scope.$apply();
apiController.sync(null);
// refresh every 30s
setInterval(function () {
apiController.sync(null);
}, 30000);
});
$scope.allTag = new Tag({all: true});
$scope.allTag.title = "All";
$scope.tags = modelManager.tags;
$scope.allTag.notes = modelManager.notes;
apiController.sync(null);
// refresh every 30s
setInterval(function () {
apiController.sync(null);
}, 30000);
/*
Tags Ctrl Callbacks
*/