Barefoot.DataStore.Server

This mixin contains client specific code for the Barefoot.DataStore component.

Code for serializing the DataStore on the server is contained here.

See also

Summary
Barefoot.DataStore.ServerThis mixin contains client specific code for the Barefoot.DataStore component.
Functions
toJSONSerializes all models and collections of this DataStore into a plain JavaScript object.

Functions

toJSON

function toJSON()

Serializes all models and collections of this DataStore into a plain JavaScript object.

Beside the actual data, this object contains meta information to accomplish a proper deserialization with Barefoot.DataStore.Client.parse.  This means, the DataStore can completely restore its content from a given serialized version of itself, including correct model and collection types.

Please make sure you registered all model and collection types with Barefoot.DataStore.registerModel and Barefoot.DataStore.registerCollection.  Otherwise parse will throw an error as soon as i tries to deserialize such an object.

Returns

(Object) A serialized version of this DataStore

The DataStore is a core object and extends the Barefoot.Model.
function toJSON()
Serializes all models and collections of this DataStore into a plain JavaScript object.
This mixin contains client specific code for the Barefoot.DataStore component.
function parse(serializedStore)
Takes serialized DataStore information (most commonly created with Barefoot.DataStore.Server.toJSON) and tries to restore the described datastructure.
function registerModel(identifier,
model)
Registers a specific Barefoot.Model or Barefoot.Collection with the given identifier.
function registerCollection(identifier,
model)
An alias for registerModel.
Close