Source: stbStorage.js

/**
 * STB object declaration and documentation.
 * JSDoc specification ({@link http://usejsdoc.org/}).
 * An introduction to JSDoc ({@link http://www.2ality.com/2011/08/jsdoc-intro.html}).
 *
 * @fileOverview Provides API to access global key-value storage.
 */

'use strict';

/* jshint unused:false */

//noinspection JSUnusedGlobalSymbols

/**
 * Global key-value storage.
 *
 * @see {@link http://dev.w3.org/html5/webstorage/#storage-0|W3C Web Storage specification}
 *
 * @namespace
 */
var stbStorage = {

	/**
	 * Get the total number of keys.
	 *
	 * @readonly
	 * @type {number}
	 *
	 * @since 0.2.18
	 */
	length: 0,


	/**
	 * Remove all the keys and data.
	 *
	 * @since 0.2.18
	 */
	clear:
		function () {},


	/**
	 * Get the key name by its index.
	 * If there is no key associated with the index then return null.
	 *
	 * @param {number} index key position
	 *
	 * @return {?string} key name or null if the key does not exist
	 *
	 * @example
	 * // get key name by its position in the storage hash
	 * var keyName = stbStorage.key(3);
	 *
	 * @since 0.2.18
	 */
	key:
		function ( index ) { return ''; },

	/**
	 * Get key's value using key name.
	 *
	 * See {@link stbStorage.setItem}.
	 *
	 * @param {string} keyName unique key name
	 *
	 * @return {?string} key value or null if the key does not exist
	 *
	 * @example
	 * // receive key value
	 * var data = stbStorage.getItem('someName');
	 *
	 * @since 0.2.18
	 */
	getItem:
		function ( keyName ) { return ''; },


	/**
	 * Set key value for key `keyName`.
	 * Old key value will be replaced with the new one.
	 * If there was no value associated with the key then new one will be stored.
	 *
	 * See {@link stbStorage.getItem}.
	 *
	 * @param {string} keyName unique key name
	 * @param {(string|number)} keyValue new key value
	 *
	 * @example
	 * // create or update key
	 * stbStorage.setItem('someName', 128);
	 *
	 * @since 0.2.18
	 */
	setItem:
		function ( keyName, keyValue ) {},


	/**
	 * Remove the given key.
	 *
	 * @param {string} keyName unique key name
	 *
	 * @example
	 * // delete key
	 * stbStorage.removeItem('someName');
	 *
	 * @since 0.2.18
	 */
	removeItem:
		function ( keyName ) { return true; }

};