Browse Source

No transmitter (angular recreate feature)

Aleksandr Aleksandrov 6 years ago
parent
commit
91bc07f9cf

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@ex-helpers/element",
-  "version": "0.1.13",
+  "version": "0.1.14",
   "description": "Several element wrapper helpers",
   "scripts": {
     "build": "exb",

+ 0 - 4
src/element.ts

@@ -1,5 +1,3 @@
-import {TransmitterInterface} from './transmitter/interface/transmitter.interface';
-
 declare module '@angular/core' {
 
     class ElementRef<T = any> {
@@ -16,7 +14,5 @@ declare module '@angular/core' {
         watchChanges?: (callback: MutationCallback, options: MutationObserverInit) => () => void;
 
         triggerSizeCheck?: () => void;
-
-        transmitter?: TransmitterInterface;
     }
 }

+ 0 - 3
src/transmitter/index.ts

@@ -1,3 +0,0 @@
-export * from './interface/transmitter.interface';
-export * from './interface/transmitterable.interface';
-export * from './transmitter';

+ 0 - 7
src/transmitter/interface/transmitter.interface.ts

@@ -1,7 +0,0 @@
-import {CommonStackManager} from '@ex-helpers/stack';
-import {TransmitterableInterface} from './transmitterable.interface';
-import {Observable} from 'rxjs';
-
-export interface TransmitterInterface extends CommonStackManager<TransmitterableInterface, string> {
-    waitFor<T = any>(name: string): Observable<TransmitterableInterface<T>>;
-}

+ 0 - 4
src/transmitter/interface/transmitterable.interface.ts

@@ -1,4 +0,0 @@
-export interface TransmitterableInterface<T = any> {
-    name: string;
-    data: T;
-}

+ 0 - 35
src/transmitter/transmitter.ts

@@ -1,35 +0,0 @@
-import {ElementRef} from '@angular/core';
-import {TransmitterInterface} from './interface/transmitter.interface';
-import {CommonStackManager} from '@ex-helpers/stack';
-import {TransmitterableInterface} from './interface/transmitterable.interface';
-import {Observable} from 'rxjs';
-
-export class Transmitter extends CommonStackManager<TransmitterableInterface, string> implements TransmitterInterface {
-    public static get(ref: ElementRef): TransmitterInterface {
-        if (!ref.transmitter) {
-            ref.transmitter = new Transmitter(ref);
-        }
-        return ref.transmitter;
-    }
-
-    constructor(public ref: ElementRef) {
-        super('name');
-    }
-
-    public waitFor<T>(name: string): Observable<TransmitterableInterface<T>> {
-        return new Observable(observer => {
-            const s = this.subscribe(() => {
-                const item = this.get(name);
-                if (item) {
-                    observer.next(item);
-                    observer.complete();
-                    if (s) {
-                        s.unsubscribe();
-                    } else {
-                        setTimeout(() => s.unsubscribe());
-                    }
-                }
-            });
-        });
-    }
-}