Skip to content

Instantly share code, notes, and snippets.

@hendrikswan
Created June 15, 2017 06:50
Show Gist options
  • Save hendrikswan/4904a10ea2ce87e316a661978c7b1367 to your computer and use it in GitHub Desktop.
Save hendrikswan/4904a10ea2ce87e316a661978c7b1367 to your computer and use it in GitHub Desktop.
const pendingItems = new Rx.Subject();
pendingItems.subscribe((item) => {
api.syncEvent(item)
.then((result) => {
console.log('successfully synced a mouse event');
})
.catch((reason) => {
console.error('got an error while trying to sync an event')
});
});
function syncMouseEvent(event) {
pendingItems.next({
x: event.clientX,
y: event.clientY
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment