Skip to content
This repository has been archived by the owner on Jan 10, 2022. It is now read-only.
Júlio César Batista edited this page Jul 12, 2013 · 2 revisions

Welcome to the Ext.ux.webstorage.Storage wiki!

Storage

config

  • storage

  • The HTML5 StorageArea to store the values (_localStorage _or sessionStorage).

  • arrayDelimiter

  • A string to separate array items when using _setArray _and getArray

  • namespace

  • A string to concatenate with a key to avoid duplicate keys among apps. This config is used by set and get.

  • textCompactor

  • A boolean value (true) to use the default _TextCompactor _or an object with two functions (_compress _and decompress).

methods

  • get(String key, [Function fn])

  • Returns a string value for the given key. If specified it returns what fn returns.

  • set(String key, Mixed value)

  • Stores the _value _using the key.

  • getJson(String key)

  • Try to return a JSON value for the key. This method uses JSON.parse native function.

  • setJson(String key, Object value)

  • This method stores the data in JSON format using JSON.stringify native function.

  • getArray(String key)

  • Returns an array for the key. This method uses the arrayDelimiter config.

  • setArray(String key, Array value)

  • Stores an array using the arrayDelimiter config to separate values.

  • getBoolean(String key)

  • Returns a boolean value. It will only return if the value is the "true", otherwise it will return false.

  • getNumber(String key)

  • Returns a number value.

  • getKey(String key)

  • Returns the key concatenated with the namespace config if it's defined. If the namespace is undefined, it will return only the key.

events

  • beforestorage(String key, Mixed value, Ext.ux.webstorage.Storage this, StorageArea storage)

  • This event is fired before setting a value. If the event returns false the value is not stored.

  • afterstorage(String key, Mixed value, Ext.ux.webstorage.Storage this, StorageArea storage)

  • This event is fired after setting a value.

  • storage(StorageEvent event, Ext.ux.webstorage.Storage this)

  • The window's sorage event.

TextCompactor

  • compress(String text)

  • Compress the given text storing 2 chars in place of 1.

  • decompress(String text)

  • Decompress the given text. The text must be compressed by the compress function.

Clone this wiki locally