EXT JS中是否有全局变量 [英] Is there Global variables in EXT JS
问题描述
在Java和C ++中,我们可以全局存储变量,并可以从项目中的任何位置访问其值.
说,我在一个名为Residence
的类中,并且我将作为INT
的residenceNumber
保存到名为houseNumberGlobalVariable
的全局变量中.
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
.
现在,我可以从项目中的任何类访问houseNumberGlobalVariable
.以类似的方式,我可以使用EXTJS
中的Global变量.
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.
我需要从一个类中设置一个值,并从另一个类中访问它. EXT JS中的等效项是什么.我认为EXTJS中没有全局变量概念,但是等效概念是什么?
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 ?
推荐答案
只需在app.js
中声明一个变量,它将用作全局变量.
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;
这篇关于EXT JS中是否有全局变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!