File

projects/i-components/src/lib/services/change-dection-notifier.service.ts

Index

Properties
Methods
Accessors

Methods

applicationDetectChanges
applicationDetectChanges(cdRef: ChangeDetectorRef)

Performs an application changes detection action to update the UI against possible changes

Parameters :
Name Type Optional
cdRef ChangeDetectorRef No
Returns : void
notifyDetectChanges
notifyDetectChanges(component: BaseComponent)

Notify XamTile current state changed

Parameters :
Name Type Optional
component BaseComponent No
Returns : void

Properties

Private changeDetectionService
Type : Subject<any>
Default value : new Subject<any>()

Subject service for change detection

timeout
Type : any

Timeout to debounce the change detection action

timer
Type : number
Default value : 50

Time before triggering the change detection

Accessors

changeDetectionAction
getchangeDetectionAction()

Subscription event to handle the XamTile state changed

Returns : Observable<any>
import { ChangeDetectorRef, Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs';
import { BaseComponent } from '../components/base/base.component';

@Injectable({
  providedIn: 'root',
})
export class ChangeDectionNotifierService {
  /**
   * Time before triggering the change detection
   *
   * @memberof ChangeDectionNotifierService
   */
  timer = 50;

  /**
   * Timeout to debounce the change detection action
   *
   * @type {*}
   * @memberof ChangeDectionNotifierService
   */
  timeout: any;
  /**
   * Subject service for change detection
   *
   * @private
   * @type {Subject<any>}
   * @memberof BaseComponent
   */
  private changeDetectionService: Subject<any> = new Subject<any>();

  /**
   * Subscription event to handle the XamTile state changed
   *
   * @readonly
   * @type {Observable<XamTileComponent>}
   * @memberof XamTileManagerService
   */
  get changeDetectionAction(): Observable<any> {
    return this.changeDetectionService.asObservable();
  }

  /**
   * Notify XamTile current state changed
   *
   * @param {*} void
   * @memberof XamTileManagerService
   */
  notifyDetectChanges(component: BaseComponent): void {
    this.changeDetectionService.next(component);
  }

  /**
   * Performs an application changes detection action to
   * update the UI against possible changes
   *
   * @memberof ChangeDectionNotifierService
   */
  applicationDetectChanges(cdRef: ChangeDetectorRef): void {
    /* istanbul ignore else */
    if (!cdRef['destroyed']) {
      cdRef.detectChanges();
    }
  }
}

result-matching ""

    No results matching ""