2015-12-07 19:38:12 -05:00
|
|
|
// #docregion Observable
|
2015-12-12 11:29:02 -05:00
|
|
|
import {Observable} from 'rxjs/Observable';
|
2015-12-07 19:38:12 -05:00
|
|
|
import 'rxjs/add/operator/map';
|
|
|
|
|
|
|
|
var obs = new Observable(obs => {
|
|
|
|
var i = 0;
|
|
|
|
setInterval(_ => obs.next(++i), 1000);
|
|
|
|
});
|
|
|
|
obs.map(i => `${i} seconds elapsed`).subscribe(msg => console.log(msg));
|
|
|
|
// #enddocregion
|