annotate src/app/app.component.ts @ 17:ff964b28a272

Clear waveform before redrawing, otherwise the waveform is not drawn. also remove some debug outputs.
author Lucas Thompson <dev@lucas.im>
date Thu, 27 Oct 2016 17:47:20 +0100
parents 7e3ab6f8792f
children 953932e9ba82
rev   line source
dev@16 1 import {Component, Inject, NgZone} from '@angular/core';
dev@1 2 import {MailService} from "./mail.service";
angular-cli@0 3
angular-cli@0 4 @Component({
angular-cli@0 5 selector: 'app-root',
angular-cli@0 6 templateUrl: './app.component.html',
angular-cli@0 7 styleUrls: ['./app.component.css']
angular-cli@0 8 })
angular-cli@0 9 export class AppComponent {
dev@3 10 title = 'Ugly';
dev@1 11
dev@16 12 count = 0;
dev@16 13 audioBuffer: AudioBuffer = undefined;
dev@16 14
dev@1 15 constructor(
dev@1 16 private mail: MailService,
dev@16 17 @Inject('piper-server-uri') private serverUri,
dev@16 18 private zone: NgZone
dev@1 19 ) {}
dev@1 20
dev@1 21 onUpdate(id, text) {
dev@1 22 this.mail.update(id, text);
dev@1 23 }
dev@16 24
dev@16 25 onAudioLoaded(buffer: AudioBuffer) {
dev@16 26 this.zone.run(() => { // TODO why the f does this only recognise changes immediately (and not the next tick) inside zone.run?
dev@16 27 this.audioBuffer = buffer;
dev@16 28 this.count++;
dev@16 29 });
dev@16 30 }
dev@16 31
dev@16 32 testRef() {
dev@16 33 this.count++;
dev@16 34 }
angular-cli@0 35 }