O'Reilly logo

Smashing Mobile Web Development by Greg Avola

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 11: Testing and Organizing Your Code

Now that you have finished the development of Corks, you are ready to perform some testing to get Corks ready for deployment to our web servers for use. To prepare for deployment and for easy maintenance, you need to organize your files. At the end of the project development, it’s also a good practice to refactor your code to place each JavaScript function into its own file. When dealing with mobile bandwidth, loading multiple small files is better than loading one large JavaScript file. You can accomplish this by removing the white spaces between each line in your JavaScript to decrease the size.

This chapter discusses refactoring your code by looking for improvements and moving each section into its own separate JavaScript and caching via manifest cache. Then you look into using optimization plug-ins such as head.js to deliver the contents of your JavaScript files asynchronously as the page loads. Finally, you determine your app’s compatibility with multiple browsers.

In this chapter, you test, clean up, and refactor your code on Corks. By the end of this chapter, you should have accomplished the following:

Organize your JavaScript code

Know how to use head.js and the manifest cache

Learn some testing techniques for mobile apps

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required