Skip to content

Instantly share code, notes, and snippets.

@hendrikswan
Last active June 15, 2017 09:47
Show Gist options
  • Select an option

  • Save hendrikswan/b7588396845bc88824b588390da72367 to your computer and use it in GitHub Desktop.

Select an option

Save hendrikswan/b7588396845bc88824b588390da72367 to your computer and use it in GitHub Desktop.
const sync = createSync({
maxRetries: 3,
delayBetweenRetries: 2000,
syncAction: api.syncEvent,
});
// success
sync.syncedItems.subscribe(x => console.log(x.item));
// failure
sync.failedItems.subscribe(x => console.error(x.item));
function syncMouseEvent(event) {
sync.queue({
x: event.clientX,
y: event.clientY
});
}
function onConnectionDropped() {
sync.pause();
}
function onConnectionResumed() {
sync.resume();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment