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

com.vaadin.polymer.app.AppStorageBehavior Maven / Gradle / Ivy

The newest version!
/*
 * This code was generated with Vaadin Web Component GWT API Generator, 
 * from app-storage project by The Polymer Authors
 * that is licensed with http://polymer.github.io/LICENSE.txt license.
 */
package com.vaadin.polymer.app;

import com.vaadin.polymer.elemental.*;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;


/**
 * 

AppStorageBehavior is an abstract behavior that makes it easy to
synchronize in-memory data and a persistant storage system, such as
the browser’s IndexedDB, or a remote database like Firebase.

*

For examples of how to use this behavior to write your own app storage
elements see <app-localstorage-document> here, or check out
polymerfire and
app-pouchdb.

*/ @JsType(isNative=true) public interface AppStorageBehavior { @JsOverlay public static final String NAME = "Polymer.AppStorageBehavior"; @JsOverlay public static final String SRC = "app-storage/app-storage-behavior.html"; /** *

The data to synchronize.

* * JavaScript Info: * @property data * @type Object * @behavior AppPouchdbDocument */ @JsProperty JavaScriptObject getData(); /** *

The data to synchronize.

* * JavaScript Info: * @property data * @type Object * @behavior AppPouchdbDocument */ @JsProperty void setData(JavaScriptObject value); /** *

Override this getter to return true if the value has never been
persisted to storage.

* * JavaScript Info: * @property isNew * @type boolean * @behavior AppPouchdbDocument */ @JsProperty boolean getIsNew(); /** *

Override this getter to return true if the value has never been
persisted to storage.

* * JavaScript Info: * @property isNew * @type boolean * @behavior AppPouchdbDocument */ @JsProperty void setIsNew(boolean value); /** *

When true, will perform detailed logging.

* * JavaScript Info: * @property log * @type Boolean * @behavior AppPouchdbDocument */ @JsProperty boolean getLog(); /** *

When true, will perform detailed logging.

* * JavaScript Info: * @property log * @type Boolean * @behavior AppPouchdbDocument */ @JsProperty void setLog(boolean value); /** *

If this is true transactions will happen one after the other,
never in parallel.

*

Specifically, no transaction will begin until every previously
enqueued transaction by this element has completed.

*

If it is false, new transactions will be executed as they are
received.

* * JavaScript Info: * @property sequentialTransactions * @type Boolean * @behavior AppPouchdbDocument */ @JsProperty boolean getSequentialTransactions(); /** *

If this is true transactions will happen one after the other,
never in parallel.

*

Specifically, no transaction will begin until every previously
enqueued transaction by this element has completed.

*

If it is false, new transactions will be executed as they are
received.

* * JavaScript Info: * @property sequentialTransactions * @type Boolean * @behavior AppPouchdbDocument */ @JsProperty void setSequentialTransactions(boolean value); /** *

A promise that will resolve once all queued transactions
have completed.

*

This field is updated as new transactions are enqueued, so it will
only wait for transactions which were enqueued when the field
was accessed.

*

This promise never rejects.

* * JavaScript Info: * @property transactionsComplete * @type Promise * @behavior AppPouchdbDocument */ @JsProperty JavaScriptObject getTransactionsComplete(); /** *

A promise that will resolve once all queued transactions
have completed.

*

This field is updated as new transactions are enqueued, so it will
only wait for transactions which were enqueued when the field
was accessed.

*

This promise never rejects.

* * JavaScript Info: * @property transactionsComplete * @type Promise * @behavior AppPouchdbDocument */ @JsProperty void setTransactionsComplete(JavaScriptObject value); /** *

Override this getter to define the default value to use when
there’s no data stored.

* * JavaScript Info: * @property zeroValue * @type * * @behavior AppPouchdbDocument */ @JsProperty JavaScriptObject getZeroValue(); /** *

Override this getter to define the default value to use when
there’s no data stored.

* * JavaScript Info: * @property zeroValue * @type * * @behavior AppPouchdbDocument */ @JsProperty void setZeroValue(JavaScriptObject value); /** *

A convenience method. Returns true iff value is null, undefined,
an empty array, or an object with no keys.

* * JavaScript Info: * @method valueIsEmpty * @param {} value * @behavior AppPouchdbDocument * */ void valueIsEmpty(Object value); /** *

Override this method.

*

If the data value represented by this storage instance is new, this
method generates an attempt to write the value to storage.

* * JavaScript Info: * @method saveValue * @param {*} args * @behavior AppPouchdbDocument * @return {JavaScriptObject} */ JavaScriptObject saveValue(JavaScriptObject args); /** *

Override this method to implement creating and updating
stored values.

* * JavaScript Info: * @method setStoredValue * @param {string} storagePath * @param {*} value * @behavior AppPouchdbDocument * @return {JavaScriptObject} */ JavaScriptObject setStoredValue(String storagePath, JavaScriptObject value); /** *

Perform the initial sync between storage and memory. This method
is called automatically while the element is being initialized.
Implementations may override it.

*

If an implementation intends to call this method, it should instead
call _initializeStoredValue, which provides reentrancy protection.

* * JavaScript Info: * @method initializeStoredValue * @behavior AppPouchdbDocument * @return {JavaScriptObject} */ JavaScriptObject initializeStoredValue(); /** *

Remove the data from storage.

* * JavaScript Info: * @method destroy * @behavior AppPouchdbDocument * @return {JavaScriptObject} */ JavaScriptObject destroy(); /** *

Optional. Override this method to clear out the mapping of this
storage object and a logical location within storage.

*

If this method is supported, after it’s called, isNew() should be
true.

* * JavaScript Info: * @method reset * @behavior AppPouchdbDocument * */ void reset(); /** *

Override this method to implement reading a value from storage.

* * JavaScript Info: * @method getStoredValue * @param {string} storagePath * @behavior AppPouchdbDocument * @return {JavaScriptObject} */ JavaScriptObject getStoredValue(String storagePath); /** *

Maps a storage path to the corresponding Polymer databinding path.
Override to define a custom mapping.

*

The inverse of memoryPathToStoragePath.

* * JavaScript Info: * @method storagePathToMemoryPath * @param {string} path * @behavior AppPouchdbDocument * @return {String} */ String storagePathToMemoryPath(String path); /** *

Maps a Polymer databinding path to the corresponding path in the
storage system. Override to define a custom mapping.

*

The inverse of storagePathToMemoryPath.

* * JavaScript Info: * @method memoryPathToStoragePath * @param {string} path * @behavior AppPouchdbDocument * @return {String} */ String memoryPathToStoragePath(String path); /** *

Enables performing transformations on the in-memory representation of
storage without activating observers that will cause those
transformations to be re-applied to the storage backend. This is useful
for preventing redundant (or cyclical) application of transformations.

* * JavaScript Info: * @method syncToMemory * @param {Function} operation * @behavior AppPouchdbDocument * */ void syncToMemory(Function operation); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy