]>
git.proxmox.com Git - extjs.git/blob - extjs/classic/classic/src/state/Manager.js
2 * This is the global state manager. By default all components that are "state aware" check this class
3 * for state information if you don't pass them a custom state provider. In order for this class
4 * to be useful, it must be initialized with a provider when your application initializes. Example usage:
6 * // in your initialization function
8 * Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
11 * This class passes on calls from components to the underlying {@link Ext.state.Provider} so that
12 * there is a common interface that can be used without needing to refer to a specific provider instance
15 Ext
.define('Ext.state.Manager', {
18 requires
: ['Ext.state.Provider'],
20 constructor: function() {
21 this.provider
= new Ext
.state
.Provider();
25 * Configures the default state provider for your application
26 * @param {Ext.state.Provider} stateProvider The state provider to set
28 setProvider: function (stateProvider
) {
29 this.provider
= stateProvider
;
33 * Returns the current value for a key
34 * @param {String} key The key name
35 * @param {Object} defaultValue The default value to return if the key lookup does not match
36 * @return {Object} The state data
38 get: function (key
, defaultValue
) {
39 return this.provider
.get(key
, defaultValue
);
43 * Sets the value for a key
44 * @param {String} key The key name
45 * @param {Object} value The state data
47 set: function (key
, value
) {
48 this.provider
.set(key
, value
);
52 * Clears a value from the state
53 * @param {String} key The key name
55 clear: function (key
) {
56 this.provider
.clear(key
);
60 * Gets the currently configured state provider
61 * @return {Ext.state.Provider} The state provider
63 getProvider: function () {