Skip to content

Instantly share code, notes, and snippets.

@Kelin2025
Created March 17, 2018 18:44
Show Gist options
  • Save Kelin2025/d7a85c50817757eed5ba56d8ee214a44 to your computer and use it in GitHub Desktop.
Save Kelin2025/d7a85c50817757eed5ba56d8ee214a44 to your computer and use it in GitHub Desktop.
Apicase events
doRequest({ url: '/api/posts' })
.on('done', res => console.log('Success'))
.on('fail', res => console.log('Failed but it is OK'))
.on('error', err => console.log('JS Error', err))
.on('cancel', (_) => console.log('Request was cancelled'))
.on('progress', (p) => console.log('XHR progress', p.loaded / p.total))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment