|
|
|
|
|
|
|
|
import {AfterViewInit, Component, ElementRef, OnInit, ViewChild} from '@angular/core'; |
|
|
|
|
|
import {SocketService} from "./shared/services/socket.service"; |
|
|
|
|
|
import {AlarmSoundService} from "./shared/services/alarm-sound.service"; |
|
|
|
|
|
|
|
|
import { |
|
|
|
|
|
AfterViewInit, |
|
|
|
|
|
Component, |
|
|
|
|
|
ElementRef, |
|
|
|
|
|
OnInit, |
|
|
|
|
|
ViewChild, |
|
|
|
|
|
} from '@angular/core'; |
|
|
|
|
|
import { SocketService } from './shared/services/socket.service'; |
|
|
|
|
|
import { AlarmSoundService } from './shared/services/alarm-sound.service'; |
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
selector: 'app-root', |
|
|
selector: 'app-root', |
|
|
templateUrl: './app.component.html', |
|
|
templateUrl: './app.component.html', |
|
|
styleUrls: ['./app.component.scss'] |
|
|
|
|
|
|
|
|
styleUrls: ['./app.component.scss'], |
|
|
}) |
|
|
}) |
|
|
export class AppComponent implements OnInit, AfterViewInit { |
|
|
|
|
|
|
|
|
export class AppComponent implements OnInit { |
|
|
title = 'Iot-web-ui'; |
|
|
title = 'Iot-web-ui'; |
|
|
@ViewChild('clickButton') clickButton!: ElementRef<HTMLButtonElement>; |
|
|
|
|
|
|
|
|
|
|
|
constructor(private socketService$: SocketService, |
|
|
|
|
|
public alarmSoundService$: AlarmSoundService,) { |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
constructor(private socketService$: SocketService) {} |
|
|
|
|
|
|
|
|
ngOnInit() { |
|
|
ngOnInit() { |
|
|
this.socketService$.connect(); |
|
|
this.socketService$.connect(); |
|
|
} |
|
|
} |
|
|
ngAfterViewInit(): void { |
|
|
|
|
|
console.log('click'); |
|
|
|
|
|
this.simulateButtonClick(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
simulateButtonClick() { |
|
|
|
|
|
this.alarmSoundService$.simulateClick(this.clickButton.nativeElement); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |