Sencha touch 2 global variable

Source: Internet
Author: User

After two hours of searching for data, I found that defining variables is so simple that all documents in China are copy, with no technical content;

The data store url I accessed is used to drive the bullet parameters,

1. I define a variable, VAR Params = 'test ';

However, my other JS files have not responded by modifying his values.

2. Ext. Define MyApp. App. config

In the application, requires ['myapp. App. config']

 
MyApp. App. config. getparams ();

I never gave up.

3. Define in the build:

Var_params:
'Test ';

Setparams: function (ARG ){


This. var_params = ARG

}

Getparams: function (){

Retun this. var_params

}

This method does not work either. It has been depressing for a long time.

4. Finally, I found this method in my foreign documents:

Set it:localStorage.setItem('currentUserId',
userID)
 

Get it:localStorage.getItem('currentUserId') 

This is a great method. The call is successful!


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.