Print Friendly

# Class YAHOO.ext.state.CookieProvider

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

The default Provider implementation. The example below includes all valid configuration options and their default values.

    var cp = new YAHOO.ext.state.CookieProvider({
           path: '/',
           expires: new Date(new Date().getTime()+(1000*60*60*24*7)); //7 days
           domain: null,
           secure: false
       })
       YAHOO.ext.state.Manager.setProvider(cp);

## Public Properties

This class has no public properties.

## Public Methods

Method | Defined By
--- | ---
| CookieProvider(`Object config`) | CookieProvider
Create a new CookieProvider
| 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.

## Constructor Details

### CookieProvider

`public function CookieProvider(`Object config`)`
Create a new CookieProvider
Parameters:

- `config` : Object
  The configuration object

## 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.