Skip to content

Instantly share code, notes, and snippets.

@MariuszWisniewski
Created May 9, 2014 21:45
Show Gist options
  • Save MariuszWisniewski/3a5092e1e12031b31090 to your computer and use it in GitHub Desktop.
Save MariuszWisniewski/3a5092e1e12031b31090 to your computer and use it in GitHub Desktop.
// The function below is used for notification/subscription processing of the position of the note.
// When the position of the note is moved across one device, all other devices connected to Syncano will real-time sync to the same position.
updatePosition: function (element) {
var self = this;
var position = element.position();
var xPos = Math.round(position.left);
var yPos = Math.round(position.top);
var noteId = self.findNote(element.attr('id'));
self.syncano.sendRequest({
type: 'call',
method: 'data.update',
params: {
project_id: self.options.projectId,
collection_id: self.options.collectionId,
data_id: noteId,
xpos: xPos,
ypos: yPos,
sourcePlayer: self.syncano.uuid + '#' + self.token(),
update_method: 'merge',
}
}, function () {
console.log('Position Updated');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment