( StackBlitz | jsBin | jsFiddle )
// RxJS v6+
import { of } from 'rxjs';
//emits any number of provided values in sequence
const source = of(1, 2, 3, 4, 5);
//output: 1,2,3,4,5
const subscribe = source.subscribe(val => console.log(val));
( StackBlitz | jsBin | jsFiddle )
// RxJS v6+
import { of } from 'rxjs';
//emits values of any type
const source = of({ name: 'Brian' }, [1, 2, 3], function hello() {
return 'Hello';
});
//output: {name: 'Brian'}, [1,2,3], function hello() { return 'Hello' }
const subscribe = source.subscribe(val => console.log(val));
- Battleship Game
- Breakout Game
- Car Racing Game
- Mine Sweeper Game
- Platform Jumper Game
- Save Indicator
- Swipe To Refresh
- Tetris Game
- Type Ahead
- of 📰 - Official docs
- of - In Depth Dev Reference
- Creation operators: of 🎥 💵 - André Staltz
- Build your own of operator 🎥 - Kwinten Pisman
📁 Source Code: https://github.com/ReactiveX/rxjs/blob/master/src/internal/observable/of.ts