File

src/app/modules/telemetry/directives/telemetry-end/telemetry-end.directive.ts

Implements

OnDestroy

Metadata

Index

Properties
Methods
Inputs
HostListeners

Constructor

constructor(telemetryService: TelemetryService)

Constructor to create injected service(s) object Default method of Draft Component class

Parameters :
Name Type Optional Description
telemetryService TelemetryService No

Reference of TelemetryService

Inputs

appTelemetryEnd
Type : IEndEventInput

Interact event input

HostListeners

window:unload
Arguments : '$event'

Methods

endEvent
endEvent()
Returns : void
ngOnDestroy
ngOnDestroy()
Returns : void
unloadHandler
unloadHandler(event)
Decorators :
@HostListener('window:unload', ['$event'])
Parameters :
Name Optional
event No
Returns : void

Properties

Public telemetryService
Type : TelemetryService

reference of permissionService service.

import { Directive, Input, OnDestroy, HostListener } from '@angular/core';
import { IEndEventInput } from '../../interfaces';
import { TelemetryService } from '../../services';

@Directive({
  selector: '[appTelemetryEnd]'
})
export class TelemetryEndDirective implements OnDestroy {

  /**
   * Interact event input
  */
  @Input() appTelemetryEnd: IEndEventInput;
  /**
   * reference of permissionService service.
  */
  public telemetryService: TelemetryService;
  /**
  * Constructor to create injected service(s) object
  Default method of Draft Component class
  * @param {TelemetryService} telemetryService Reference of TelemetryService
  */
  constructor(telemetryService: TelemetryService) {
    this.telemetryService = telemetryService;
  }

  @HostListener('window:unload', ['$event'])
  unloadHandler(event) {
   this.endEvent();
  }

  ngOnDestroy() {
    this.endEvent();
  }
  endEvent () {
    if (this.appTelemetryEnd) {
      this.telemetryService.end(this.appTelemetryEnd);
    }
  }
}

results matching ""

    No results matching ""