move broadcaster to jslib
This commit is contained in:
parent
7122d5ed89
commit
e04e064515
2
jslib
2
jslib
|
@ -1 +1 @@
|
|||
Subproject commit 0b9c2f518d72b3b3a6bcf97f97bc7dfa15b4e153
|
||||
Subproject commit 5d66ede2ea1e73ba0ad8bf949bd74992e7a78582
|
|
@ -25,7 +25,7 @@ import { PasswordGeneratorHistoryComponent } from './vault/password-generator-hi
|
|||
import { ToasterService } from 'angular2-toaster';
|
||||
import { Angulartics2 } from 'angulartics2';
|
||||
|
||||
import { BroadcasterService } from './services/broadcaster.service';
|
||||
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
|
||||
|
||||
import { AuthService } from 'jslib/abstractions/auth.service';
|
||||
import { CipherService } from 'jslib/abstractions/cipher.service';
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
export class BroadcasterService {
|
||||
subscribers: Map<string, (message: any) => any> = new Map<string, (message: any) => any>();
|
||||
|
||||
send(message: any, id?: string) {
|
||||
if (id != null) {
|
||||
if (this.subscribers.has(id)) {
|
||||
this.subscribers.get(id)(message);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this.subscribers.forEach((value) => {
|
||||
value(message);
|
||||
});
|
||||
}
|
||||
|
||||
subscribe(id: string, messageCallback: (message: any) => any) {
|
||||
if (this.subscribers.has(id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.subscribers.set(id, messageCallback);
|
||||
}
|
||||
|
||||
unsubscribe(id: string) {
|
||||
if (this.subscribers.has(id)) {
|
||||
this.subscribers.delete(id);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@ import { I18nService } from '../../services/i18n.service';
|
|||
import { LogService } from '../../services/log.service';
|
||||
|
||||
import { AuthGuardService } from 'jslib/angular/services/auth-guard.service';
|
||||
import { BroadcasterService } from './broadcaster.service';
|
||||
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
|
||||
import { ValidationService } from 'jslib/angular/services/validation.service';
|
||||
|
||||
import { Analytics } from 'jslib/misc/analytics';
|
||||
|
|
|
@ -21,7 +21,7 @@ import { Angulartics2 } from 'angulartics2';
|
|||
|
||||
import { ModalComponent } from '../modal.component';
|
||||
|
||||
import { BroadcasterService } from '../services/broadcaster.service';
|
||||
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
|
||||
|
||||
import { AddEditComponent } from './add-edit.component';
|
||||
import { AttachmentsComponent } from './attachments.component';
|
||||
|
|
|
@ -2,7 +2,7 @@ import { ipcRenderer } from 'electron';
|
|||
|
||||
import { MessagingService } from 'jslib/abstractions/messaging.service';
|
||||
|
||||
import { BroadcasterService } from '../app/services/broadcaster.service';
|
||||
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
|
||||
|
||||
export class DesktopRendererMessagingService implements MessagingService {
|
||||
constructor(private broadcasterService: BroadcasterService) {
|
||||
|
|
Loading…
Reference in New Issue