ing
This commit is contained in:
parent
13f2c6d089
commit
73d4672cbb
|
@ -32,11 +32,13 @@ export interface SubscriberMethod {
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RPCSubscribeService {
|
export class RPCSubscribeService {
|
||||||
|
private subscriberTypes: Set<Type<any>>;
|
||||||
private subscribers: Set<any>;
|
private subscribers: Set<any>;
|
||||||
private subscriberMethodMap: Map<string, SubscriberMethod[]>;
|
private subscriberMethodMap: Map<string, SubscriberMethod[]>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
) {
|
) {
|
||||||
|
this.subscriberTypes = new Set();
|
||||||
this.subscribers = new Set();
|
this.subscribers = new Set();
|
||||||
this.subscriberMethodMap = new Map();
|
this.subscriberMethodMap = new Map();
|
||||||
}
|
}
|
||||||
|
@ -44,12 +46,12 @@ export class RPCSubscribeService {
|
||||||
public addSubscriber(subscriber: Type<any>): void {
|
public addSubscriber(subscriber: Type<any>): void {
|
||||||
const type = TypeUtil.getType(subscriber);
|
const type = TypeUtil.getType(subscriber);
|
||||||
|
|
||||||
if (this.subscribers.has(subscriber)) {
|
if (this.subscriberTypes.has(type)) {
|
||||||
console.log(`Subscriber[${type.name}] has been added`);
|
console.log(`Subscriber[${type.name}] has been added`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.subscribers.add(subscriber);
|
this.subscriberTypes.add(type);
|
||||||
|
|
||||||
const clazz = Class.forType(type);
|
const clazz = Class.forType(type);
|
||||||
if (undefined === clazz) {
|
if (undefined === clazz) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user