store.js - niyogakiza/Openclassroom_Project-8 GitHub Wiki

store.js

This file manages our database and the functions that go with it, we define the store with a name and the possibility of having a callback, it creates a database and new todos list if it doesn't already exist

  • Two functions to search for one or all elements are available, in a case is one element it takes it as an object and callback, when has completed the running, in another case, will retrieve all data from the collection and take a callback.
  • Then we have a function to save or update the data of an item in our database.
  • Function remove will delete an item from the database with its id
  • The last drop function will delete all data and start from scratch, drop is used in database as delete.