view src/app/app.module.ts @ 93:8f2b2aed0df1

Update cli config to conform to latest version, needed to move around my worker bootstrapping bodge. Angular-cli for some reason now includes global scripts as strings in the webpack bundle, and they are eval'ed. So TypeScript no longer gets compiled. So once again I chase the mouse, re-purposing the new polyfill field to compile and bundle externals.ts once more!
author Lucas Thompson <dev@lucas.im>
date Thu, 23 Feb 2017 22:15:52 +0000
parents f5072712ddf5
children edddb2a5cf10
line wrap: on
line source
import { BrowserModule } from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

import { AppComponent } from './app.component';
import { MaterialModule } from "@angular/material";
import { WaveformComponent } from './waveform/waveform.component';
import { AudioFileOpenComponent } from './audio-file-open/audio-file-open.component';
import { PlaybackControlComponent } from './playback-control/playback-control.component';
import { AudioPlayerService } from "./services/audio-player/audio-player.service";
import { FeatureExtractionService } from "./services/feature-extraction/feature-extraction.service";
import { FeatureExtractionMenuComponent } from "./feature-extraction-menu/feature-extraction-menu.component";

export function createAudioContext(): AudioContext {
  return new (
    (window as any).AudioContext
    || (window as any).webkitAudioContext
  )();
}

@NgModule({
  declarations: [
    AppComponent,
    WaveformComponent,
    AudioFileOpenComponent,
    PlaybackControlComponent,
    FeatureExtractionMenuComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    MaterialModule
  ],
  providers: [
    {provide: HTMLAudioElement, useValue: new Audio() }, // TODO use something more generic than HTMLAudioElement
    {provide: 'AudioContext', useValue: createAudioContext()}, // use a string token, Safari doesn't seem to like AudioContext
    AudioPlayerService,
    FeatureExtractionService,
    {provide: 'PiperRepoUri', useValue: 'assets/remote-plugins.json'}
  ],
  bootstrap: [AppComponent]
})
export class AppModule {

}