JavaScript Ext JS State default storage time _extjs

Source: Internet
Author: User
Copy Code code as follows:

Ext.state.CookieProvider = function (config) {
Ext.state.CookieProvider.superclass.constructor.call (this);
This.path = "/";
This.expires = new Date (new Date (). GetTime () + (1000*60*60*24*7)); 7 days
This.domain = null;
This.secure = false;
Ext.apply (this, config);
This.state = This.readcookies ();
};
Ext.state.CookieProvider = function (config) {
Ext.state.CookieProvider.superclass.constructor.call (this);
This.path = "/";
This.expires = new Date (new Date (). GetTime () + (1000*60*60*24*7)); 7 days
This.domain = null;
This.secure = false;
Ext.apply (this, config);
This.state = This.readcookies ();
};

We can change the default storage time by setting the expires value, for example:
Copy Code code as follows:

This.expires:new Date (new Date (). GetTime () + (1000*60*60*24*365)),//One year
This.expires:new Date (new Date (). GetTime () + (1000*60*60*24*365)),//One year

Or we can add the following code to the Ext.onready function in the start position
Copy Code code as follows:

Ext.state.Manager.setProvider (
New Ext.state.CookieProvider ({
Expires:new Date (new Date (). GetTime () + (1000*60*60*24*365)),//One year
}));

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.