import { ViewRef , ChangeDetectorRef } from "@angular/core" ; import { MultiLingualData } from "../core/multilingual-data" ; const NG_CONTEXT = "__ngContext__" ; const NG_ELEMENT_ID = "__NG_ELEMENT_ID__" ; const LVIEW = "_lView" ; const CD_REF_INJECTING_VIEW = "_cdRefInjectingView" ; const CONSTRUCTOR = "constructor" ; export class RxChangeDetectorRef extends ChangeDetectorRef { viewRef : ViewRef ; constructor ( public instance ) { super ( ) ; } createViewRef ( ) { if ( this . instance [ NG_CONTEXT ] && this . instance [ NG_CONTEXT ] . rxRefMarkedId === undefined ) { let emulatedDom = this . instance [ NG_CONTEXT ] [ 11 ] ; if ( emulatedDom && emulatedDom . component && emulatedDom . component . onPush ) { this . viewRef = super [ CONSTRUCTOR ] [ NG_ELEMENT_ID ] ( ) ; this . viewRef [ LVIEW ] = this . viewRef [ CD_REF_INJECTING_VIEW ] = this . instance [ NG_CONTEXT ] [ 14 ] ; } this . setDestroyHooks ( ) ; this . instance [ NG_CONTEXT ] . rxRefMarkedId = Math . random ( ) ; } return this . viewRef ; } setDestroyHooks ( ) { let tView = this . instance [ NG_CONTEXT ] [ 1 ] ; if ( ! tView . destroyHooks ) tView . destroyHooks = [ this . instance [ NG_CONTEXT ] . length - 1 , ( ) => { MultiLingualData . removeComponentPropValue ( this . instance . constructor , this . instance [ NG_CONTEXT ] . rxRefMarkedId ) ; } ] ; else tView . destroyHooks . push ( this . instance [ NG_CONTEXT ] . length - 1 , ( ) => { MultiLingualData . removeComponentPropValue ( this . instance . constructor , this . instance [ NG_CONTEXT ] . rxRefMarkedId ) ; } ) ; } markForCheck ( ) { this . viewRef . markForCheck ( ) ; } detach ( ) { throw new Error ( "Method not implemented." ) ; } detectChanges ( ) { throw new Error ( "Method not implemented." ) ; } checkNoChanges ( ) { throw new Error ( "Method not implemented." ) ; } reattach ( ) { throw new Error ( "Method not implemented." ) ; } }