Example #1
0
				.then((fixture: ComponentFixture) => {
					fixture.detectChanges();
					ee.subscribe(null, null, () => {
						let logo: Element = fixture.nativeElement.querySelector('glyph');
						expect(logo.querySelector('svg')).not.toBe(null);
					});
				});
Example #2
0
    constructor(public location: Location, public route: Router) {
        this.locationChanged = false;
        this.actionEmitter = ActionNavigation.getEmitter();

        this.actionEmitter.subscribe(event => {
            //this.location.go('/'+event);

            //console.log('emitting', ActionNavigation.getEventEmitter(event));
            ActionNavigation.getEventEmitter(event).emit('start');
             
            //this.route.recognize(event);
        });
    }
Example #3
0
  constructor() {
    this.loginEvent = new EventEmitter();

    // If I implement revocation of JWTs from the server side, make sure to
    // cache JWTs that are revoked until they expire.
    this.loginEvent.subscribe((jwtResult: IJWT) => {
      this.jwtResult = jwtResult;
    });
    this.loggedIn = this.loginEvent
      .map((jwtResult: IJWT) => {
      return Boolean(jwtResult && jwtResult.aud);
    });
    // Necessary because you can't negate an Observable<boolean> or assign
    // within a map function inside a template
    this.loggedOut = this.loggedIn.map(b => !b);
  }
    constructor() {

        this.webSocket = new WebSocket("ws://localhost:3001");

        this.isReady = false;

        this.pending = new Array<string>();

        this.emitter = new EventEmitter<string>();

        this.resolveMap = new Map<Object, Object>();

        this.webSocket.onerror = ((event) => {
            console.log(event);
        });

        this.webSocket.onmessage = ((event) => {
            this.emitter.next(event);
        });

        this.webSocket.onclose = ((event) => {
            console.log(event);
        });

        this.webSocket.onopen = ((event) => {
            console.log(event);
            this.isReady = true;
            this.pending.forEach(request => {
                this.webSocket.send(request);
            });
        });

        this.emitter.subscribe((event) => {
            let data = JSON.parse(event.data);
            let resolve = this.resolveMap.get(data.file);
            console.log(data.content);
            console.log(resolve);
        });

    }
Example #5
0
 @Input() set reloadEvent(v: EventEmitter<void>) {
     v.subscribe(() => this.refresh());
 }
Example #6
0
 return new Promise((resolve, reject) => {
   this.loginEvent.subscribe(
     (jwtResult: IJWT) => { resolve(jwtResult); },
     (err: any) => { reject(err); }
     );
 });