import { AfterContentInit, AfterViewInit, Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; import {ActivatedRoute} from '@angular/router'; interface addthis { layers: Refresh; init: Function; toolbox: Function; } interface Refresh { refresh: Function; } declare var addthis: addthis; @Component({ selector: 'addThis', template: `

` }) export class AddThisComponent implements OnInit { @Output() event: EventEmitter = new EventEmitter(); constructor(private route: ActivatedRoute) {} ngOnInit() { this.route.queryParams.subscribe(data => { if (typeof document !== 'undefined' && typeof addthis !== 'undefined') { if(addthis.layers && addthis.layers.refresh) { addthis.layers.refresh(); } else { this.event.emit(false); } } else { this.event.emit(false); } }); } }