PlayerIO

The fastest way to build online games without breaking a sweat.

HTML5 (Javascript) Client Reference

javascript (html5) databaseobject class informationClass databaseobject

Language: Javascript (HTML5)

This class represents a database object in BigDB. It contains all the data of the database object, as well as a method for persisting any changes back to BigDB.

Properties

 
existsInDatabase :bool

Returns true if this object has been persisted

key :string

The key of the database object

table :string

The table of the database object

Methods

 
save (useOptimisticLock, fullOverwrite, successCallback, errorCallback):

Persist the object to the database, using optimistic locking and full overwrite if specified.

databaseobject.existsInDatabase

Returns true if this object has been persisted

databaseobject.key

key :string

The key of the database object

databaseobject.table

table :string

The table of the database object

databaseobject.save

save (useOptimisticLock, fullOverwrite, successCallback, errorCallback):

Persist the object to the database, using optimistic locking and full overwrite if specified.

Arguments

useOptimisticLock:bool
If true, the save will only be completed if the database object has not changed in BigDB since this instance was loaded.
fullOverwrite:bool
Will completely overwrite the database object in BigDB with the properties in this instance, instead of just sending the changed properties to the server.
successCallback:function()
Callback function that will be called when the object have been successfully saved
errorCallback:function(PlayerIOError)
Callback function that will be called if an error occurs