要旨
import { interval } from 'rxjs'; const observable = interval(1000); const subscription = observable. subscribe(i => console.log(i)); setTimeout(() => subscription.unsubscribe(), 3000);
出力
/app # node tmp.js 0 1 /app #
import { interval } from 'rxjs'; const observable = interval(1000); const subscription = observable. subscribe(i => console.log(i)); setTimeout(() => subscription.unsubscribe(), 3000);
/app # node tmp.js 0 1 /app #