public/javascripts/yui/storage/storage.js
function(key, data) {
			Y.log("SETTING " + data + " to " + key);
			
			if (YL.isString(key)) {
				var eventType = this.hasKey(key) ? YU.StorageEvent.TYPE_UPDATE_ITEM : YU.StorageEvent.TYPE_ADD_ITEM,
					oldValue = this._getItem(key);
				if (! oldValue) {oldValue = null;}

				if (this._setItem(key, this._createValue(data))) {
					this.fireEvent(this.CE_CHANGE, new YU.StorageEvent(this, key, oldValue, data, eventType));
				}
				else {
					// this is thrown according to the HTML5 spec
					throw('QUOTA_EXCEEDED_ERROR - Storage.setItem - The choosen storage method (' +
						  this.getName() + ') has exceeded capacity');
				}
			}
			else {
				// HTML 5 spec says to do nothing
			}
		}
function(key, data) {
			Y.log("SETTING " + data + " to " + key);
			
			if (YL.isString(key)) {
				var eventType = this.hasKey(key) ? YU.StorageEvent.TYPE_UPDATE_ITEM : YU.StorageEvent.TYPE_ADD_ITEM,
					oldValue = this._getItem(key);
				if (! oldValue) {oldValue = null;}

				if (this._setItem(key, this._createValue(data))) {
					this.fireEvent(this.CE_CHANGE, new YU.StorageEvent(this, key, oldValue, data, eventType));
				}
				else {
					// this is thrown according to the HTML5 spec
					throw('QUOTA_EXCEEDED_ERROR - Storage.setItem - The choosen storage method (' +
						  this.getName() + ') has exceeded capacity');
				}
			}
			else {
				// HTML 5 spec says to do nothing
			}
		}
function ( key , data ) { Y . log ( "SETTING " + data + " to " + key ) ; if ( YL . isString ( key ) ) { var eventType = this . hasKey ( key ) ? YU . StorageEvent . TYPE_UPDATE_ITEM : YU . StorageEvent . TYPE_ADD_ITEM , oldValue = this . _getItem ( key ) ; if ( ! oldValue ) { oldValue = null ; } if ( this . _setItem ( key , this . _createValue ( data ) ) ) { this . fireEvent ( this . CE_CHANGE , new YU . StorageEvent ( this , key , oldValue , data , eventType ) ) ; } else { // this is thrown according to the HTML5 spec throw ( 'QUOTA_EXCEEDED_ERROR - Storage.setItem - The choosen storage method (' + this . getName ( ) + ') has exceeded capacity' ) ; } } else { // HTML 5 spec says to do nothing } }
Adds an item to the data storage.
@method setItem
@param key {String} Required. The key used to reference this value (DOMString in HTML 5 spec).
@param data {Object} Required. The data to store at key (DOMString in HTML 5 spec).
@public
@throws QUOTA_EXCEEDED_ERROR
Adds an item to the data storage .