annotate src/app/app.component.ts @ 16:7e3ab6f8792f

Rough waveform loading, issues exist regarding communicating changes from child components (unless using the current workaround with explicit zone running)... investigating.
author Lucas Thompson <dev@lucas.im>
date Thu, 27 Oct 2016 17:08:57 +0100
parents b4a1e0a67389
children ff964b28a272
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 console.log("audio loaded");
dev@16 28 this.audioBuffer = buffer;
dev@16 29 this.count++;
dev@16 30 });
dev@16 31 }
dev@16 32
dev@16 33 testRef() {
dev@16 34 this.count++;
dev@16 35 }
angular-cli@0 36 }