Chapter 6. Finish the Model and Data modules
This chapter covers
- Designing the chat object portion of the Model
- Implementing the chat object and testing its API
- Completing the Chat feature module
- Creating a new Avatar feature module
- Using jQuery for data binding
- Communicating with the server using the Data module
This chapter concludes the work on the Model and feature modules begun in chapter 5. Before starting, you should have the project files from chapter 5, as we’ll be adding to them. We recommend you copy the entire directory structure you created in chapter 5 into a “chapter_6” directory and update them there.
In this chapter we design and build the chat object portion of the Model. We then complete the Chat slider UI by having it use and respond to the chat object API. We also add an Avatar feature module which also uses the chat object API to display on-screen representations of online people. We discuss how we accomplish data binding using jQuery. Finally, we complete the client portion of the SPA with the addition of the Data module.
Let’s start by designing the chat object.
In this chapter we will build the chat object portion of the Model as shown in figure 6.1.
In the last chapter we designed, built, and tested the people object portion of the Model. In this chapter we’ll design, build, and test the chat object. Let’s revisit the API specification we first presented in chapter 4: