Last active
June 15, 2017 09:14
-
-
Save hendrikswan/331d31bbd12ba7a55e74f78391fdc5d4 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
| pendingItems | |
| .map(item => Rx.Observable.of(item).delay(item.sync.counter > 0 ? delayBetweenRetries : 0)) | |
| .mergeAll() | |
| .subscribe((itemWithMetaData) => { | |
| api.syncEvent(itemWithMetaData.item) | |
| .then((result) => { | |
| console.log('successfully synced a mouse event'); | |
| }) | |
| .catch((reason) => { | |
| console.error('got an error while trying to sync an event, going to try again'); | |
| queue(itemWithMetaData); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment