import { of } from 'rxjs'; const myObs = of(1, 2, 3); myObs.subscribe(val => console.log(val)); // output: 1, 2, 3
import { of } from 'rxjs'; import { delay } from 'rxjs/operators'; const myObs = of(1, 2, 3).pipe(delay(1000)); myObs.subscribe(val => console.log(val)); // output: 1, 2, 3 (after 1 sec each)Here, we use the `delay()` operator from the `rxjs` library to create a delayed Observable stream. We pass `1000` milliseconds as the delay time for each emitted value. When we subscribe to this Observable, we can observe the values emitted after the specified delay time. Package/Library: The package library used in these code examples is `rxjs`, which provides us with all the necessary tools, including `Observable` and its creation methods, operators, and associated utilities, to create and manage Observable data streams.