mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +00:00
Deprecated broadcaster (#5461)
This commit is contained in:
@@ -156,6 +156,12 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
window.onkeypress = () => this.recordActivity();
|
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.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => {
|
||||||
this.ngZone.run(async () => {
|
this.ngZone.run(async () => {
|
||||||
switch (message.command) {
|
switch (message.command) {
|
||||||
|
|||||||
@@ -98,6 +98,12 @@ export class AppComponent implements OnDestroy, OnInit {
|
|||||||
window.onkeypress = () => this.recordActivity();
|
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.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => {
|
||||||
this.ngZone.run(async () => {
|
this.ngZone.run(async () => {
|
||||||
switch (message.command) {
|
switch (message.command) {
|
||||||
|
|||||||
@@ -2,8 +2,20 @@ export interface MessageBase {
|
|||||||
command: string;
|
command: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use the observable from the appropriate service instead.
|
||||||
|
*/
|
||||||
export abstract class BroadcasterService {
|
export abstract class BroadcasterService {
|
||||||
|
/**
|
||||||
|
* @deprecated Use the observable from the appropriate service instead.
|
||||||
|
*/
|
||||||
send: (message: MessageBase, id?: string) => void;
|
send: (message: MessageBase, id?: string) => void;
|
||||||
|
/**
|
||||||
|
* @deprecated Use the observable from the appropriate service instead.
|
||||||
|
*/
|
||||||
subscribe: (id: string, messageCallback: (message: MessageBase) => void) => void;
|
subscribe: (id: string, messageCallback: (message: MessageBase) => void) => void;
|
||||||
|
/**
|
||||||
|
* @deprecated Use the observable from the appropriate service instead.
|
||||||
|
*/
|
||||||
unsubscribe: (id: string) => void;
|
unsubscribe: (id: string) => void;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user