view src/app/audio-file-open/audio-file-open.component.ts @ 54:5fb857f8553b

Add a number of ad-hoc workarounds for bugs / quirks with waves-ui - regarding removing layers and avoiding ghost listeners. Still work to be done here.
author Lucas Thompson <dev@lucas.im>
date Thu, 08 Dec 2016 15:09:03 +0000
parents 5bdfcf493646
children 53ea6406d601
line wrap: on
line source
import {
  Component, OnInit, ViewChild, ElementRef, Output,
  EventEmitter, NgZone
} from '@angular/core';

@Component({
  selector: 'app-audio-file-open',
  templateUrl: './audio-file-open.component.html',
  styleUrls: ['./audio-file-open.component.css']
})
export class AudioFileOpenComponent implements OnInit {

  @ViewChild('open') open: ElementRef;
  @Output() fileOpened: EventEmitter<File>;

  constructor() {
    this.fileOpened = new EventEmitter<File>();
  }

  ngOnInit() {
  }

  decodeAudio(files: FileList) {
    if (files.length > 0) {
      this.fileOpened.emit(files[0]);
    }
  }

  openAudioDialog() {
    this.open.nativeElement.click();
  }
}