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

javascript Ext JS state default storage time_extjs

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 18:56:081033browse
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
}));
Statement:
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