Print Friendly

# Class YAHOO.ext.state.Provider

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

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

## Public Properties

This class has no public properties.

## Public Methods

Method | Defined By
--- | ---
| clear() : void | Provider
Clear a value from the state.
| decodeValue(`String value`) : Mixed | Provider
Decodes a string previously encoded with encodeValue.
| encodeValue(`Mixed value`) : String | Provider
Encode a value including type information.
| get(`String name`, `Mixed defaultValue`) : Mixed | Provider
Get the current value for a key.
| set(`String name`, `Mixed value`) : void | Provider
Set 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()`
Clear a value from the state.
Parameters:

- None.

Returns:

- `void`

This method is defined by Provider.

### decodeValue

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

- `value` : String

Returns:

- `Mixed`
  The value

This method is defined by Provider.

### encodeValue

`public function encodeValue(`Mixed value`)`
Encode a value including type information.
Parameters:

- `value` : Mixed

Returns:

- `String`

This method is defined by Provider.

### get

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

- `name` : String
- `defaultValue` : Mixed

Returns:

- `Mixed`

This method is defined by Provider.

### set

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

- `name` : String
- `value` : Mixed

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
- `key` : String
  The state key which was changed
- `value` : String
  The encoded value for the state

This event is defined by Provider.

yui-ext - Copyright © 2006 Jack Slocum. | Yahoo! UI - Copyright © 2006 Yahoo! Inc.
All rights reserved.