This file contains 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
interface D { d: boolean; } | |
interface E { e: string; } | |
interface F { f: number; } | |
interface A { x: D; } | |
interface B { x: E; } | |
interface C { x: F; } | |
type ABC = A & B & C; |
This file contains 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
import {Observable} from 'rxjs'; | |
let source = Observable | |
.of('coding blast', 'badword', 'coding', 'blast') | |
.map(w => w + ' RxJS'); | |
console.log('before subscribe'); | |
source.subscribe(function next(value) { | |
console.log('Subscriber - next: ', value); |
This file contains 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
let source = Observable.create(observer => { | |
for (let word of words) { | |
if (word === 'badword') { | |
throw new Error('Bad word!'); | |
} | |
observer.next(word); | |
} | |
observer.complete(); |
This file contains 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
import {Observable} from 'rxjs'; | |
let words = ['coding blast', 'badword', 'coding', 'blast']; | |
let source = Observable.create(observer => { | |
for (let word of words) { | |
if (word === 'badword') { | |
observer.error('Bad word!'); | |
} |
This file contains 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
import {Observable} from 'rxjs'; | |
let words = ['coding blast', 'badword', 'coding', 'blast']; | |
let source = Observable.create(observer => { | |
for (let word of words) { | |
if (word === 'badword') { | |
observer.error('Bad word!'); | |
} |
This file contains 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
import {Observable} from 'rxjs'; | |
let words = ['coding blast', 'coding', 'blast']; | |
let source = Observable.create(observer => { | |
for (let word of words) { | |
observer.next(word); | |
} | |
observer.complete(); | |
}); |
This file contains 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
source.subscribe(next); | |
function next(value: any) { | |
console.log('next: ', value); | |
} |
This file contains 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
import { Observable } from 'rxjs'; | |
let words = ['coding blast', 'badword', 'coding', 'blast']; | |
let source = Observable.create(observer =>{ | |
for (let word of words) { | |
if (word === 'badword') { | |
observer.error('Bad word!'); | |
} | |
This file contains 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
import { Observable } from 'rxjs'; | |
let numbers = [1, 2, 3]; | |
let source = Observable | |
.from(numbers) | |
.map(n => n * 2) | |
.filter(n => n > 5); | |
This file contains 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
import { Observable } from 'rxjs'; | |
interface ISimpleObserver<T> { | |
next: (value: T) => void; | |
error: (err: any) => void; | |
complete: () => void; | |
} | |
let words = ['coding blast', 'coding', 'blast']; |