Created
March 20, 2015 15:30
-
-
Save joshbedo/64dc4f60d1d97ba6c332 to your computer and use it in GitHub Desktop.
long-polling React
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
@ProgressBar = ProgressBar({ pending: file_export.completed_items, total: file_export.total_items }) | |
if @inProgress(file_export) | |
do poll = () => | |
setTimeout (=> | |
debugger | |
$.ajax( | |
url: '/api/v1/file_exports.json', | |
success: (data) => | |
@ProgressBar.setState({ pending: data.completed_items }) | |
error: (data) => | |
console.log('error') | |
complete: poll | |
) | |
), 5000, this | |
return @ProgressBar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment