new DiffSyncClient(config) → {object}
Status: Experimental
The AeroGear Differential Sync Client.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
Object | A configuration
Properties
|
Returns:
diffSyncClient - The created DiffSyncClient
- Type
- object
Methods
-
_diff(data) → {Object}
-
diff - an internal method to perform a diff with the Sync Server
Parameters:
Name Type Description data
Object the data to perform a diff on Returns:
- An Object containing the edits from the Sync Engine- Type
- Object
-
_patch(data)
-
patch - an internal method to sync the data with the Sync Engine
Parameters:
Name Type Description data
Object The data to be patched -
_sendEdits(edit)
-
sendEdits - an internal method to send the edits from the Sync Engine to the Sync Server
Parameters:
Name Type Description edit
Object the edits to be sent to the server -
addDocument(doc)
-
addDocument - Adds a document to the Sync Engine
Parameters:
Name Type Description doc
Object a document to add to the sync engine -
connect()
-
Connects to the Differential Sync Server using WebSockets
-
disconnect()
-
Disconnects from the Differential Sync Server closing it's Websocket connection
-
fetch(docId)
-
fetch - fetch a document from the Sync Server. Will perform a sync on it
Parameters:
Name Type Description docId
String the id of a document to fetch from the Server -
getDocument(id) → {Object}
-
getDocument - gets the document from the Sync Engine
Parameters:
Name Type Description id
String the id of the document to get Returns:
- The document from the sync engine- Type
- Object
-
removeDoc()
-
removeDoc TODO
-
sync(data)
-
sync - performs the Sync process
Parameters:
Name Type Description data
Object the Data to be sync'd with the server -
<inner> send(msgType, doc)
-
send
Parameters:
Name Type Description msgType
String doc
Object