tinymce.util.LocalStorage

This class will simulate LocalStorage on IE 7 and return the native version on modern browsers. Storage is done using userData on IE 7 and a special serialization format. The format is designed to be as small as possible by making sure that the keys and values doesn't need to be encoded. This makes it possible to store for example HTML data. Storage format for userData: <base 32 key length>,<key string>,<base 32 value length>,<value>,... For example this data key1=value1,key2=value2 would be: 4,key1,6,value1,4,key2,6,value2

Examples

tinymce.util.LocalStorage.setItem('key', 'value');
var value = tinymce.util.LocalStorage.getItem('key');

Properties

name type summary defined by
length Number Length of the number of items in storage. tinymce.util.LocalStorage

Methods

name summary defined by
clear() Removes all items. tinymce.util.LocalStorage
getItem() Returns the value if the specified key or null if it wasn't found. tinymce.util.LocalStorage
key() Returns the key name by index. tinymce.util.LocalStorage
removeItem() Removes the specified item by key. tinymce.util.LocalStorage
setItem() Sets the value of the specified item by it's key. tinymce.util.LocalStorage

Methods

clear

clear()

Removes all items.

getItem

getItem(key:String):String

Returns the value if the specified key or null if it wasn't found.

Parameters
Return value

key

key(index:Number):String

Returns the key name by index.

Parameters
Return value

removeItem

removeItem(key:String)

Removes the specified item by key.

Parameters

setItem

setItem(key:String, value:String)

Sets the value of the specified item by it's key.

Parameters

Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.