Skip to content

Instantly share code, notes, and snippets.

@jamesmorgan
Last active March 18, 2016 14:21
Show Gist options
  • Save jamesmorgan/39070a449266db247edd to your computer and use it in GitHub Desktop.
Save jamesmorgan/39070a449266db247edd to your computer and use it in GitHub Desktop.
using advanced RxJs suscriber features
// You must import this or the actual feature you require form rxjs to use things like delay(), map(), retry()
import 'rxjs/Rx';
...
export class Test {
constructor(private _http:Http) {
_http.get('http://localhost:8080/competitions')
.map(res => res.json()) // map to json
.delay(2000) // atrificially delay the
.retry(3) // attempt to retry x number of times
.subscribe(
...
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment