0.0.7 • Published 10 months ago

p_iframe_bootstrapper_ts v0.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

use below command to install the package

npm install p_iframe_bootstrapper_ts

Usage for angular project

import { Component, ElementRef, AfterViewInit, ViewChild } from '@angular/core';
import { payverisIframeInitalizer, PayverisIframeInitializerOptions } from 'p_iframe_bootstrapper_ts';

@Component({
  template: `<iframe #iframeElement src="https://www.<app_url>.com" frameborder="0"></iframe>`
})
export class AppComponent implements AfterViewInit {
  /* The `@ViewChild('iframeElement')` decorator is used to query and obtain a reference to the
  `iframeElement` element in the component's template. The `iframeElement` property is then declared
  with the `ElementRef` type, which allows access to the underlying DOM element of the iframe. This
  reference is used in the `ngAfterViewInit` lifecycle hook to attach an `onload` event handler to
  the iframe element. */
  @ViewChild('iframeElement') iframeElement!: ElementRef;

  /**
   * The ngAfterViewInit function sets an onload event listener on an iframe element and calls the
   * onLoadIframe function when the iframe has finished loading.
   */
  ngAfterViewInit() {
    this.iframeElement.nativeElement.onload = () => this.onLoadIframe();
  }

  /**
   * The function initializes a Payveris iframe with specified options.
   */
  onLoadIframe() {
    const options: PayverisIframeInitializerOptions = {
      loggingEnabled: true,
      isBillCenter: true
    };

    payverisIframeInitalizer.init(options, this.iframeElement.nativeElement);
  }
}
0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago