import { interval } from 'rxjs';
// Create an Observable that will publish a value on an interval
const secondsCounter = interval(1000);
// Subscribe to begin publishing values
secondsCounter.subscribe(n =>
console.log(`It's been ${n} seconds since subscribing!`));
如上所示, 首先引入rxjs,其次定义一个 一秒的循环 函数, 然后调用该函数,并输出该时间