indexeddb implementation, #15
This commit is contained in:
@@ -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();
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user