Chapter 10. Class system foundations


This chapter covers

  • Understanding prototypal inheritance
  • Developing your first extension
  • Knowing how plug-ins work
  • Developing a real-world plug-in
  • Looking into the Sencha Touch class loader

Every Sencha Touch developer faces challenges where reusability is an issue. Often, a component of an application is required to appear more than once within the application’s usage lifetime. Without mastering these techniques you could end up with what’s known as “function soup,” or unmaintainable code. This is why we’ll focus on the concept of reusability by the use of framework extensions and plug-ins.

In the first section of this chapter you’ll learn the basics of extending (subclassing) with Sencha Touch. You’ll begin by learning how to create subclasses with JavaScript, where you’ll see what it takes to get the job done with the native language tools. This section will give you the foundation to refactor your newly created subclass to use the Sencha Touch class system.

Once you’re familiar with creating basic subclasses you’ll focus your attention on extending Sencha Touch components. You’ll have fun learning the basics of framework extensions, and you’ll solve a real-world problem by extending the grid Panel widget and see it in action.

10.1. Classic JavaScript inheritance

10.2. Using the Sencha Touch class system

10.3. Extending Sencha Touch components

10.4. Creating a Sencha Touch plug-in

10.5. Summary