To do list Application overview - Jenliszka/todoapp GitHub Wiki
The To-do app was created using the MVC architectural pattern
Controller:
controller.js handles incoming requests, interpreting the mouse and keyboard inputs from the user, informing the model and/or the view to change as appropriate. Takes a model and view and acts as the controller between them. In our app this includes such functions as:
- setView - Loads and initialises the view
- showAll - An event to fire on load. Will get all items and display them in the todo-list
- showActive - Renders all active tasks
- showCompleted - Renders all completed tasks
Model:
model.js manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller). In our app this includes such functions as:
- read - Finds and returns a model in storage. If no query is given it'll simply return everything. If you pass in a string or number it'll look that up as the ID of the model to find. Lastly, you can pass it an object to match against.
- create - creates a new todo model.
- remove - Removes a model from storage
- getCount - Returns a count of all todos
View:
view.js manages the display of information. View that abstracts away the browser's DOM completely. It has two simple entry points:
- bind(eventName, handler) - Takes a todo application event and registers the handler
- render(command, parameterObject) - Renders the given command with the options
Other Javascript files:
app.js - Sets up a brand new Todo list.
helpers.js - Gets elements by CSS selector, adds event listener, attaches a handler to event for all elements tat match the selector based on root element, finds element's parent with the given tag name, and allows for looping on nodes by chaining.
store.js - Creates a new client side storage object and will create an empty collection if no collection already exists.
template.js - Sets up defaults for all the Template methods such as a default template
Dependencies:
Node modules:
- todomvc-common npm package
- todomvc-app-csstodomvc-app-css ###Test:
- Dev dependencies: jasmine-core