- A lot of behavior is being defined directly in the
.ready()
event, which probably could be moved to an object. - The object sizes are really unbalanced: notes_make_manager only has one function defined, while the other two have 5+
- A lot of variables are being evaluated by jQuery rather than being passed in as arguments, so there are often non-obvious dependencies on the html for the code to work properly. An example is this code, which is getting the user inputted note from the boxes. It might make more sense to use a form here, so that way the data would presumably be available for the submit button's click event.
- I'm also realizing that my current strategy of just writing the notes directly to the local storage with keys like
note_0
andnote_1
evaluating directly to those specific notes puts too much faith in my indexing system always being correct. Since these notes can be deleted and added by the user unpredictably, and the index doesn't really matter as far as persistence goes, it would make more sense to store the notes in a notes array that would be written to local storage. I will do this tomorrow
I'm making good progress on the app, but I don't like how my object structure is looking right now. I don't yet know what approach to take to make it better, though.
As of now, the delete button will delete the notes from local storage but does not update the ui by deleting the note list item. As long as you make sure to reload the app each time you delete a note, it works as you would expect :).
I also added an empty note body css class, which is added to notes when the body is found to be empty. I think it's better to do UI stuff in css over javascript, so I'll try to do that sort of thing more in the future. I should probably switch my 'Untitled Note' heading if the title is left blank over to css as well.
No comments:
Post a Comment