How to unsubscribe/stop Observable?

前端 未结 3 1512
北海茫月
北海茫月 2020-12-17 01:30

I use the following code for timer:

export class TimerService {
  private ticks: number = 0;
  private seconds: number = 0;
  private timer;

  constructor(s         


        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-17 02:02

    So after some PUNISHING research I've added my own npm library for this problem.

    Improves previous answer by NOT having to add any extra convolution variables and ease of use.

    • StackBlitz
    • Repo
    • NPM

提交回复
热议问题