Home > Web Front-end > JS Tutorial > javascript Ext JS state default storage time_extjs

javascript Ext JS state default storage time_extjs

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 18:56:08
Original
1027 people have browsed it
Copy code The code is 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 set expires value to change the default storage time, for example:
Copy the code The code is 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 at the beginning
Copy code The code is as follows:

Ext.state.Manager.setProvider(
new Ext.state.CookieProvider({
expires: new Date(new Date().getTime() (1000*60*60*24*365)), //One year
}));
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
What are JavaScript hook functions?
From 1970-01-01 08:00:00
0
0
0
What is JavaScript garbage collection?
From 1970-01-01 08:00:00
0
0
0
c++ calls javascript
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template