File

C:/GoDev/src/TCSTK-Angular/projects/tibco-tcstk/tc-core-lib/src/lib/services/legacy-iframe.service.ts

Index

Properties

Constructor

constructor()

Properties

Private iProcessFrameReady
Default value : new BehaviorSubject(false)
Private iWorkitemFrameReady
Default value : new BehaviorSubject(false)
Public processStatus
Default value : this.iProcessFrameReady.asObservable()
Private receiveMessage
Default value : () => {...}
Public workitemStatus
Default value : this.iWorkitemFrameReady.asObservable()
import { Injectable } from '@angular/core';
import {BehaviorSubject} from 'rxjs';

@Injectable({
  providedIn: 'root'
})

export class LegacyIframeService {

  private iWorkitemFrameReady = new BehaviorSubject(false);
  private iProcessFrameReady = new BehaviorSubject(false);
  public workitemStatus = this.iWorkitemFrameReady.asObservable();
  public processStatus = this.iProcessFrameReady.asObservable();

  constructor() {
    console.log('*** service waiting for message');
    window.addEventListener('message', this.receiveMessage, false);
  }

  private receiveMessage = (event) => {
    if (event.data.action === 'workitemAppReady') {
      this.iWorkitemFrameReady.next(true);
      console.log('*** workitems iframe ready');
    } else if (event.data.action === 'processAppReady') {
      this.iProcessFrameReady.next(true);
      console.log('*** process iframe ready');
    }
  }

}

result-matching ""

    No results matching ""