Browse Source

Deprecated broadcaster (#5461)

pull/5470/head
Oscar Hinton 3 years ago committed by GitHub
parent
commit
3da7fc7cb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      apps/desktop/src/app/app.component.ts
  2. 6
      apps/web/src/app/app.component.ts
  3. 12
      libs/common/src/abstractions/broadcaster.service.ts

6
apps/desktop/src/app/app.component.ts

@ -156,6 +156,12 @@ export class AppComponent implements OnInit, OnDestroy { @@ -156,6 +156,12 @@ export class AppComponent implements OnInit, OnDestroy {
window.onkeypress = () => this.recordActivity();
});
/// ############ DEPRECATED ############
/// Please do not use the AppComponent to send events between services.
///
/// Services that depends on other services, should do so through Dependency Injection
/// and subscribe to events through that service observable.
///
this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => {
this.ngZone.run(async () => {
switch (message.command) {

6
apps/web/src/app/app.component.ts

@ -98,6 +98,12 @@ export class AppComponent implements OnDestroy, OnInit { @@ -98,6 +98,12 @@ export class AppComponent implements OnDestroy, OnInit {
window.onkeypress = () => this.recordActivity();
});
/// ############ DEPRECATED ############
/// Please do not use the AppComponent to send events between services.
///
/// Services that depends on other services, should do so through Dependency Injection
/// and subscribe to events through that service observable.
///
this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => {
this.ngZone.run(async () => {
switch (message.command) {

12
libs/common/src/abstractions/broadcaster.service.ts

@ -2,8 +2,20 @@ export interface MessageBase { @@ -2,8 +2,20 @@ export interface MessageBase {
command: string;
}
/**
* @deprecated Use the observable from the appropriate service instead.
*/
export abstract class BroadcasterService {
/**
* @deprecated Use the observable from the appropriate service instead.
*/
send: (message: MessageBase, id?: string) => void;
/**
* @deprecated Use the observable from the appropriate service instead.
*/
subscribe: (id: string, messageCallback: (message: MessageBase) => void) => void;
/**
* @deprecated Use the observable from the appropriate service instead.
*/
unsubscribe: (id: string) => void;
}

Loading…
Cancel
Save