Last active
June 15, 2017 09:47
-
-
Save hendrikswan/b7588396845bc88824b588390da72367 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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