All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.gwt.storage.client.StorageEvent Maven / Gradle / Ivy

There is a newer version: 2.10.0
Show newest version
/*
 * Copyright 2011 Google Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package com.google.gwt.storage.client;

import com.google.gwt.core.client.JavaScriptObject;

/**
 * Represents a Storage Event.
 * 
 * 

* Experimental API: This API is still under development * and is subject to change. *

* *

* A Storage Event is fired when a storage area changes, as described in these * two sections (for session * storage, for local storage). *

* * @see Handler * @see W3C Web * Storage - StorageEvent * @see Safari * StorageEvent reference */ public final class StorageEvent extends JavaScriptObject { /** * Represents an Event handler for {@link StorageEvent}s. * *

* Apply your StorageEventHandler using * {@link Storage#addStorageEventHandler(StorageEvent.Handler)}. *

* * @see StorageEvent */ public interface Handler { /** * Invoked when a StorageEvent is fired. * * @param event the fired StorageEvent * @see W3C Web * Storage - Storage Event */ void onStorageChange(StorageEvent event); } protected StorageEvent() { } /** * Returns the key being changed. * * @return the key being changed * @see W3C * Web Storage - StorageEvent.key */ public native String getKey() /*-{ return this.key; }-*/; /** * Returns the new value of the key being changed. * * @return the new value of the key being changed * @see W3C * Web Storage - StorageEvent.newValue */ public native String getNewValue() /*-{ return this.newValue; }-*/; /** * Returns the old value of the key being changed. * * @return the old value of the key being changed * @see W3C * Web Storage - StorageEvent.oldValue */ public native String getOldValue() /*-{ return this.oldValue; }-*/; /** * Returns the {@link Storage} object that was affected. * * @return the {@link Storage} object that was affected * @see W3C * Web Storage - StorageEvent.storageArea */ public Storage getStorageArea() { return Storage.impl.getStorageFromEvent(this); } /** * Returns the address of the document whose key changed. * * @return the address of the document whose key changed * @see W3C * Web Storage - StorageEvent.url */ public native String getUrl() /*-{ return this.url || this.uri; // Older Safari browsers have 'uri' instead of 'url' }-*/; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy