Package com.google.gwt.storage.client
Class StorageImpl
java.lang.Object
com.google.gwt.storage.client.StorageImpl
- Direct Known Subclasses:
StorageImplNonNativeEvents
This is the HTML5 Storage implementation according to the standard
recommendation.
Never use this class directly, instead use Storage
.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected static JavaScriptObject
static final String
static final String
protected static List
<StorageEvent.Handler> -
Constructor Summary
ModifierConstructorDescriptionprotected
This class can never be instantiated by itself. -
Method Summary
Modifier and TypeMethodDescriptionRegisters an event handler for StorageEvents.protected void
void
Removes all items in the Storage.Returns the item in the Storage associated with the specified key.int
Returns the number of items in this Storage.protected List
<StorageEvent.Handler> protected Storage
getStorageFromEvent
(StorageEvent event) Returns theStorage
object that was affected in the event.protected static final void
handleStorageEvent
(StorageEvent event) Handles StorageEvents if aStorageEvent.Handler
is registered.protected static boolean
Returnstrue
if at least one StorageEvent handler is registered,false
otherwise.Returns the key at the specified index.void
removeItem
(String storage, String key) Removes the item in the Storage associated with the specified key.void
De-registers an event handler for StorageEvents.protected void
void
Sets the value in the Storage associated with the specified key to the specified data.
-
Field Details
-
LOCAL_STORAGE
- See Also:
-
SESSION_STORAGE
- See Also:
-
storageEventHandlers
-
jsHandler
-
-
Constructor Details
-
StorageImpl
protected StorageImpl()This class can never be instantiated by itself.
-
-
Method Details
-
handleStorageEvent
Handles StorageEvents if aStorageEvent.Handler
is registered. -
hasStorageEventHandlers
protected static boolean hasStorageEventHandlers()Returnstrue
if at least one StorageEvent handler is registered,false
otherwise. -
addStorageEventHandler
Registers an event handler for StorageEvents.- Parameters:
handler
-- Returns:
HandlerRegistration
used to remove this handler- See Also:
-
clear
Removes all items in the Storage.- Parameters:
storage
- eitherLOCAL_STORAGE
orSESSION_STORAGE
- See Also:
-
getItem
Returns the item in the Storage associated with the specified key.- Parameters:
storage
- eitherLOCAL_STORAGE
orSESSION_STORAGE
key
- the key to a value in the Storage- Returns:
- the value associated with the given key
- See Also:
-
getLength
Returns the number of items in this Storage.- Parameters:
storage
- eitherLOCAL_STORAGE
orSESSION_STORAGE
- Returns:
- number of items in this Storage
- See Also:
-
key
Returns the key at the specified index.- Parameters:
storage
- eitherLOCAL_STORAGE
orSESSION_STORAGE
index
- the index of the key- Returns:
- the key at the specified index in this Storage
- See Also:
-
removeItem
Removes the item in the Storage associated with the specified key.- Parameters:
storage
- eitherLOCAL_STORAGE
orSESSION_STORAGE
key
- the key to a value in the Storage- See Also:
-
removeStorageEventHandler
De-registers an event handler for StorageEvents.- Parameters:
handler
-- See Also:
-
setItem
Sets the value in the Storage associated with the specified key to the specified data.- Parameters:
storage
- eitherLOCAL_STORAGE
orSESSION_STORAGE
key
- the key to a value in the Storagedata
- the value associated with the key- See Also:
-
addStorageEventHandler0
protected void addStorageEventHandler0() -
getStorageEventHandlers
-
getStorageFromEvent
Returns theStorage
object that was affected in the event.- Returns:
- the
Storage
object that was affected in the event.
-
removeStorageEventHandler0
protected void removeStorageEventHandler0()
-