1

Here I'm implementing a sample.js file in which designing a floating component. This sample.js file is independent of any other application. It means when i'm adding this file to sencha-touch project it should show the floating component and if i'm adding this sample.js to ext4.1 project then also it should show the component.

For this i want to know whether the application is using Sencha touch sdk or ext 4.1 sdk?

How can i achieve this?

Any help would be highly appreciated.

url
  • 71
  • 8

2 Answers2

1

We can know whether it's touch or extjs by executing the following condition

if( Ext.versions.touch ){
    //write your touch related code here
}else if( Ext.versions.extjs ){
    //write your extjs code here
}
kleopatra
  • 51,061
  • 28
  • 99
  • 211
url
  • 11
  • 1
  • Yes this works. But it is not documented nor can it be found in the source code. So can I rely on this? – sra Nov 15 '12 at 14:25
0

Ext.version is documented for Sencha Touch, Ext.versions is not. Alternative to url solution will be:

if(window.Ext) {
   if(Ext.version) {
      // Touch
   }
   else {
      // Extjs
   }
}
Vyacheslav Voronchuk
  • 2,403
  • 19
  • 16