Class: Document

Document

Primitive to store a single document in DataSync service

Properties:
Name Type Description
sid String SyncDocument unique id
uniqueName String Unique name of a document
value Object Value of a document
Fires:

Methods


mutate(mutator)

Parameters:
Name Type Description
mutator Document~Mutator Function to apply to current data in order to modify it. Can be called multiple times if same data modified remotely at the same time.
Returns:
Type
Promise.<Object>

removeDocument()

Removes document from service
Returns:
Type
Promise

set(value [, conditional])

Set new value for the document
Parameters:
Name Type Argument Default Description
value Object New value for the document
conditional Boolean <optional>
false Check for remote modification when updating. If true, promise will be rejected if value was remotely modified
Returns:
Type
Promise

update(update)

Parameters:
Name Type Description
update Object Set of fields to update
Returns:
Result data
Type
Promise.<Object>

Type Definitions


Mutator(data)

Applies a transformation to the document value
Parameters:
Name Type Description
data Object current value
Returns:
Modified value
Type
Object

Events


removed

Fired when document removed from server

removedRemotely

Fired when document removed from server remotely

updated

Fired when document value changed
Type: Object

updatedRemotely

Fired when document value changed remotely
Type: Object