12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import { ReflectiveInjector } from "@angular/core";
- import { Events } from "ionic-angular";
- // import { EventSlots } from "./event-slot";
- /**
- *
- * ███████╗██╗ ██╗███████╗███╗ ██╗████████╗███████╗███╗ ███╗ █████╗ ███╗ ██╗ █████╗ ██████╗ ███████╗██████╗
- * ██╔════╝██║ ██║██╔════╝████╗ ██║╚══██╔══╝██╔════╝████╗ ████║██╔══██╗████╗ ██║██╔══██╗██╔════╝ ██╔════╝██╔══██╗
- * █████╗ ██║ ██║█████╗ ██╔██╗ ██║ ██║ ███████╗██╔████╔██║███████║██╔██╗ ██║███████║██║ ███╗█████╗ ██████╔╝
- * ██╔══╝ ╚██╗ ██╔╝██╔══╝ ██║╚██╗██║ ██║ ╚════██║██║╚██╔╝██║██╔══██║██║╚██╗██║██╔══██║██║ ██║██╔══╝ ██╔══██╗
- * ███████╗ ╚████╔╝ ███████╗██║ ╚████║ ██║ ███████║██║ ╚═╝ ██║██║ ██║██║ ╚████║██║ ██║╚██████╔╝███████╗██║ ██║
- * ╚══════╝ ╚═══╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝
- *
- * Clase que contiene métodos que permiten compartir eventos en toda la aplicación
- */
- export abstract class EventsManager {
- private static EVENTS_INSTANCE;
- /**
- *
- */
- public static getManager(): Events {
- if (!EventsManager.EVENTS_INSTANCE) {
- EventsManager.EVENTS_INSTANCE = ReflectiveInjector.resolveAndCreate([Events]).get(Events);
- }
- return EventsManager.EVENTS_INSTANCE;
- }
- /**
- *
- * @param name
- * @param data
- */
- public static publish(name: string , data?: any): void {
- EventsManager.getManager().publish(name, data);
- }
- /**
- *
- * @param name
- */
- public static subscribe(name: string, handler: Function): any {
- EventsManager.getManager().subscribe(name, handler);
- }
- /**
- *
- * @param name
- */
- public static unsubscribe(name: string): void {
- EventsManager.getManager().unsubscribe(name);
- }
- }
|