Namespace RapidContext.Storage

Provides functions for accessing the server storage (BETA).

Source code: RapidContext_Storage.js

Namespace Summary
 
Method Summary
<static>  
RapidContext.Storage.path(obj)
Returns the storage path for an object.
<static>  
RapidContext.Storage.read(pathOrObj)
Reads an object on a storage path.
<static>  
RapidContext.Storage.update(pathOrObj, data)
Updates an object with properties from a partial object.
<static>  
RapidContext.Storage.write(pathOrObj, data)
Writes an object to a storage path.
Namespace Detail
RapidContext.Storage
Method Detail
<static> {String} RapidContext.Storage.path(obj)
Returns the storage path for an object. The object must have both the type and id properties set.
Parameters:
{Object} obj
the object to store
Returns:
{String} the storage path, or null if not available

<static> {Deferred} RapidContext.Storage.read(pathOrObj)
Reads an object on a storage path. Note that this will return a JSON representation of the object, regardless of the actual object type.
Parameters:
{String/Object} pathOrObj
the path or object to read
Returns:
{Deferred} a MochiKit.Async.Deferred object that will callback with the JSON data object

<static> {Deferred} RapidContext.Storage.write(pathOrObj, data)
Writes an object to a storage path. Any previous object on the specified path will be removed. If a path is specified without data, only the removal is performed.
Parameters:
{String/Object} pathOrObj
the path or object to write
{Object} data Optional
the object to write (if path was string)
Returns:
{Deferred} a MochiKit.Async.Deferred object that will callback with the XMLHttpRequest instance on success

<static> {Deferred} RapidContext.Storage.update(pathOrObj, data)
Updates an object with properties from a partial object. The properties in the partial object will overwrite any previous properties with the same name in the destination object. No merging of property values will be performed.
Parameters:
{String/Object} pathOrObj
the path or object to write
{Object} data
the partial object properties
Returns:
{Deferred} a MochiKit.Async.Deferred object that will callback with the updated data object on success