user5507535
user5507535

Reputation: 1800

ExtJS - Where should I put new proxy file?

I have a new proxy for a ExtJS 6.2.1 application:

Ext.define('Ext.data.proxy.MyProxy', {
    extend : 'Ext.data.proxy.Proxy',
    // ...
});

Where would be the best way to put this class in my app directory structure?
Would just creating a new proxy dir and putting it inside be OK?

Upvotes: 0

Views: 50

Answers (1)

Peter Koltai
Peter Koltai

Reputation: 9734

According to ExtJS convention, it is advised to start your class names with something that is not Ext, rather MyApp or something like that, so that you can tell which class belongs to ExtJS framework. And the last part in the class name should specify the class you are creating, which is also the name of the .js file that contains the definition.

So create a file called MyProxy.js, and define your class like:

Ext.define('MyApp.data.proxy.MyProxy', {
    extend : 'Ext.data.proxy.Proxy',
    // ...
});

In ExtJS Ext.data.proxy.Proxy is defined in a Proxy.js file in ext/data/proxy folder. So I would recommend mirroring this structure, and if your application resides in app folder (as with default settings), the full path of your own proxy class definition would be:

/app/data/proxy/MyProxy.js

Upvotes: 1

Related Questions