import { ElementRef , Renderer2 } from '@angular/core' ; hidden export function FBMLAttribute ( target , key ) { const processKey = ( _k ) => 'data-' + _k . toString ( ) . replace ( /([a-z\d])([A-Z])/g , '$1-$2' ) . toLowerCase ( ) ; Object . defineProperty ( target , key , { set : function ( value ) { value = value . toString ( ) ; this . setAttribute ( processKey ( key ) , value ) ; } , get : function ( ) { return this . getAttribute ( processKey ( key ) ) ; } , enumerable : true } ) ; } hidden export function FBMLInstanceMethod ( target , key ) { return { enumerable : true , value : function ( ... args ) { if ( this . _instance ) { return this . _instance [ key ] . apply ( this . _instance , args ) ; } else { console . warn ( 'ngx-facebook-sdk: tried calling instance method before component is ready.' ) ; return null ; } } } ; } hidden export class FBMLComponent { protected nativeElement : HTMLElement ; constructor ( private el , private rnd , private fbClass ) { this . nativeElement = this . el . nativeElement ; this . rnd . addClass ( this . nativeElement , this . fbClass ) ; } protected setAttribute ( name , value ) { if ( ! name || ! value ) return ; this . rnd . setProperty ( this . nativeElement , name , value ) ; } protected getAttribute ( name ) { if ( ! name ) return ; return this . nativeElement . getAttribute ( name ) ; } }