File

src/app/shared/services/emitter.service.ts

Description

A simple pubsub service using EventEmitter

Index

Properties
Methods

Methods

Static get
get(ID: string)
Parameters :
Name Type Optional
ID string no
Returns : EventEmitter<any>

Properties

Static Private _emitters
_emitters: literal type
Type : literal type
Default value : {}
import {Injectable, EventEmitter} from '@angular/core';

/**
 * A simple pubsub service using EventEmitter
 */
@Injectable()
export class EmitterService {
    private static _emitters: { [ID: string]: EventEmitter<any> } = {};

    static get(ID: string): EventEmitter<any> {
        if (!this._emitters[ID])
            this._emitters[ID] = new EventEmitter();
        return this._emitters[ID];
    }
}

results matching ""

    No results matching ""