Search code examples
javascriptextjsextjs4extjs4.1

Is there Global variables in EXT JS


In java and C++ we could store a variable globally and access its value from any where in the project. Say, i am inside a class called Residence and i am saving the residenceNumber which is a INT to a global variable called houseNumberGlobalVariable.

Now, i could access houseNumberGlobalVariable from any class in the project. In a similar fashion, is there a Global variable in EXTJS that i could use.

I need to set a value from one class and access it from another. What is the equivalent in EXT JS. I don't think there's a global variable concept in EXTJS, but what is the equivalent in it ?


Solution

  • Just declare a variable in app.js it will act as global variable.

    var globalVar;
    

    You can add anything into that like

    globalVar.myStore = yourStore;