refactoring LSP to its own service

This commit is contained in:
2025-05-30 00:30:54 -05:00
parent 2a9be75835
commit fc7b728fe4
5 changed files with 117 additions and 82 deletions

View File

@@ -4,19 +4,30 @@ import { BehaviorSubject, ReplaySubject, Observable } from 'rxjs';
import { ServiceMessage } from '../../types/service-message.type';
@Injectable({
providedIn: 'root'
})
export class EditorsService {
private dataSubject: ReplaySubject<ServiceMessage> = new ReplaySubject<ServiceMessage>(1);
private messageSubject: ReplaySubject<ServiceMessage> = new ReplaySubject<ServiceMessage>(1);
private activationSubject: ReplaySubject<string> = new ReplaySubject<string>(1);
constructor() {}
setData(data: ServiceMessage): void {
this.dataSubject.next(data);
this.messageSubject.next(data);
}
getData$(): Observable<ServiceMessage> {
return this.dataSubject.asObservable();
return this.messageSubject.asObservable();
}
setActiveEditor(data: string): void {
this.activationSubject.next(data);
}
newActiveEditor$(): Observable<string> {
return this.activationSubject.asObservable();
}
}