Sencha Documentation

Abstract base class for state provider implementations. The provider is responsible for setting values and extracting values to/from the underlying storage source. The storage source can vary and the details should be implemented in a subclass. For example a provider could use a server side database or the browser localstorage where supported. This class provides methods for encoding and decoding typed variables including dates and defines the Provider interface. By default these methods put the value and the type information into a delimited string that can be stored. These should be overridden in a subclass if you want to change the format of the encoded value and subsequent decoding.

Properties

 
var : Object
a -> Array n -> Number d -> Date b -> Boolean s -> String o -> Object -> Empty (null)
a -> Array n -> Number d -> Date b -> Boolean s -> String o -> Object -> Empty (null)

Methods

 
clear( String name ) : Void
Clears a value from the state
Clears a value from the state

Parameters

  • name : String
    The key name

Returns

  • Void
 
decodeValue( String value ) : Mixed
Decodes a string previously encoded with encodeValue.
Decodes a string previously encoded with encodeValue.

Parameters

  • value : String
    The value to decode

Returns

  • Mixed   The decoded value
 
encodeValue( Mixed value ) : String
Encodes a value including type information. Decode with decodeValue.
Encodes a value including type information. Decode with decodeValue.

Parameters

  • value : Mixed
    The value to encode

Returns

  • String   The encoded value
 
get( String name, Mixed defaultValue ) : Mixed
Returns the current value for a key
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
 
set( String name, Mixed value ) : Void
Sets the value for a key
Sets the value for a key

Parameters

  • name : String
    The key name
  • value : Mixed
    The value to set

Returns

  • Void

Events

 
statechange( Provider this, String key, String value )
Fires when a state change occurs.
Fires when a state change occurs.

Parameters

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

Returns

  • Void