-
Book Overview & Buying
-
Table Of Contents
Offline First Web Development
By :
We've made a lot of changes to the Item store very quickly and without much attention to the code duplication or sync efficiency. Before we go further, let's refactor the store so that it's easier to change going forward.
Right now, when we flag each database to be synchronized, we flag it for all the lists—even the lists that you don't have access to. As more people use the app, this will result in an unacceptable hit to performance. Instead, let's restrict sync to the lists that the current user owns.
Open the Item store and edit the flagStoreForSync method. Replace each usage of store with the following code:
store + '_' + me.username
Now, open the List store and edit the flagStoreForSync method here as well. Make the same substitution, but with 'list' instead:
'list' + '_' + me.username
Edit the Sync controller and modify the calculateSync method. Add the following two variable definitions to the beginning of the for loop:
var store...
Change the font size
Change margin width
Change background colour