Book Image

Learning Ext JS_Fourth Edition

Book Image

Learning Ext JS_Fourth Edition

Overview of this book

Table of Contents (22 chapters)
Learning Ext JS Fourth Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Loading classes on demand


When we develop large applications, performance is really important. We should only load the scripts we need; this means that if we have many modules in our application, we should separate them into packages so we would be able to load them individually.

Ext JS, since version 4, allows us to dynamically load classes and files when we need them, also we can configure dependencies in each class and the Ext library will load them for us.

You need to understand that using the loader is great for development, that way we can easily debug the code because the loader includes all the classes one by one. However, it's not recommended to load all the Ext classes in production environments. We should create packages of classes and then load them when needed, but not class by class.

In order to use the loader system, we need to follow some conventions when defining our class.

  • Define only one class per file.

  • The name of the class should match the name of the JavaScript file.

  • The...