https://github.com/angular/angular
Raw File
Tip revision: d69ef721d43ec62ea901cfb90d9c4e5252066f72 authored by Pawel Kozlowski on 15 February 2023, 17:30:33 UTC
release: cut the v15.1.5 release
Tip revision: d69ef72
simple-creation.2.ts
// #docplaster
/*
  Because of how the code is merged together using the doc regions,
  we need to indent the imports with the function below.
*/
// #docregion interval
  import { interval } from 'rxjs';

// #enddocregion interval

export function docRegionInterval(console: Console) {
  // #docregion interval
  // Create an Observable that will publish a value on an interval
  const secondsCounter = interval(1000);
  // Subscribe to begin publishing values
  const subscription = secondsCounter.subscribe(n =>
    console.log(`It's been ${n + 1} seconds since subscribing!`));

  // #enddocregion interval
  return subscription;
}
back to top