如果我有一个在其生命周期内发出单个值的主题的课程:
export class MyClass {
myEmitter$: Subject<void> = new Subject();
someMethod(){
this.myEmitter$.next();
this.myEmitter$.complete();
}
}
然后在另一个班级:
this.instanceOfMyClass.myEmitter.subscribe();
instanceOfMyClass.myEmitter$
鉴于主题在发出后完成,我应该取消订阅吗?