File

projects/wvr-elements/src/lib/core/ng-bindings.service.ts

Index

Properties

Properties

cdRef
cdRef: ChangeDetectorRef
Type : ChangeDetectorRef
eRef
eRef: ElementRef
Type : ElementRef
subject
subject: BehaviorSubject<any>
Type : BehaviorSubject<any>
import { ChangeDetectorRef, ElementRef, Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';

export interface RefBindingSubject {
  subject: BehaviorSubject<any>;
  cdRef: ChangeDetectorRef;
  eRef: ElementRef;
}

/**
 * A registry for AngularJS binding subjects.
 */
@Injectable({
  providedIn: 'root'
})
export class NgBindingsService {

  private readonly subjects: { [key: string]: Array<RefBindingSubject> };

  constructor() {
    this.subjects = {};
  }

  putSubject(key: string, subject: RefBindingSubject): Array<RefBindingSubject> {
    let subjects = this.subjects[key];
    if (!subjects) {
      subjects = [];
      this.subjects[key] = subjects;
    }
    this.subjects[key].push(subject);

    return this.subjects[key];
  }

}

results matching ""

    No results matching ""