What are the differences between Ext.create () and Ext.define () in SenCha Touch

I have been studying SenCha Touch for a while and still feel embarrassed when trying to create a store.

SenCha documentation says that Ext.create () should be used. Example I tried and it just doesn't work.

For the rest, I always see that people use Ext.define () to create the repository, and it works.

Now, my question is: what are the differences between them and when / how to use one of them correctly?

Some demo codes are highly rated.

Many thanks to my friends.

+8
extjs sencha-touch
source share
2 answers

define is for declaring a class.

 Ext.define('Foo', { extend: 'Bar' }); // Similar to: public class Foo : Bar { } 

create intended to create an instance:

 var o = Ext.create('Foo'); // Can also have var o = new Foo(); // Similar to: Foo o = new Foo(); 
+15
source share

Ext.create - create an instance of a predefined class. - the class was defined using Ext.define - used to define data and component behavior. which will be used later.

Ext.define - Define your own class definition - reusable component. - Instances can be created using Ext.create APIs.

+4
source share

All Articles