Print Friendly

# Class Ext.state.Provider

Package: | Ext.state
Class: | Provider
Extends: | Object
Subclasses: | CookieProvider
Defined In: | State.js

Abstract base class for state provider implementations. This class provides methods for encoding and decoding typed variables including dates and defines the Provider interface.
Properties - Methods - Events

## Public Properties

This class has no public properties.

## Public Methods

Method | Defined By
--- | ---
| clear(`String name`) : void | Provider
Clears a value from the state
| decodeValue(`String value`) : Mixed | Provider
Decodes a string previously encoded with encodeValue.
| encodeValue(`Mixed value`) : String | Provider
Encodes a value including type information. Decode with decodeValue.
| get(`String name`, `Mixed defaultValue`) : Mixed | Provider
Returns the current value for a key
| set(`String name`, `Mixed value`) : void | Provider
Sets the value for a key

## Public Events

Event | Defined By
--- | ---
| statechange : (`Provider this`, `String key`, `String value`) | Provider
Fires when a state change occurs.

## Method Details

### clear

`public function clear(`String name`)`
Clears a value from the state
Parameters:

- `name` : String
  The key name

Returns:

- `void`

This method is defined by Provider.

### decodeValue

`public function decodeValue(`String value`)`
Decodes a string previously encoded with encodeValue.
Parameters:

- `value` : String
  The value to decode

Returns:

- `Mixed`
  The decoded value

This method is defined by Provider.

### encodeValue

`public function encodeValue(`Mixed value`)`
Encodes a value including type information. Decode with decodeValue.
Parameters:

- `value` : Mixed
  The value to encode

Returns:

- `String`
  The encoded value

This method is defined by Provider.

### get

`public function get(`String name`, `Mixed defaultValue`)`
Returns the current value for a key
Parameters:

- `name` : String
  The key name
- `defaultValue` : Mixed
  A default value to return if the key's value is not found

Returns:

- `Mixed`
  The state data

This method is defined by Provider.

### set

`public function set(`String name`, `Mixed value`)`
Sets the value for a key
Parameters:

- `name` : String
  The key name
- `value` : Mixed
  The value to set

Returns:

- `void`

This method is defined by Provider.

## Event Details

### statechange

`public event statechange`
Fires when a state change occurs.
Subscribers will be called with the following parameters:

- `this` : Provider
  This state provider
- `key` : String
  The state key which was changed
- `value` : String
  The encoded value for the state

This event is defined by Provider.

Ext - Copyright © 2006-2007 Ext JS, LLC
All rights reserved.