Mercurial > hg > ugly-duckling
view src/app/app.module.ts @ 94:edddb2a5cf10
Stop angular-cli / webpack complaining by using some factories.
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Thu, 23 Feb 2017 22:20:56 +0000 |
parents | 8f2b2aed0df1 |
children | c02c76b94148 |
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 )(); } export function createAudioElement(): HTMLAudioElement { return new Audio(); } @NgModule({ declarations: [ AppComponent, WaveformComponent, AudioFileOpenComponent, PlaybackControlComponent, FeatureExtractionMenuComponent ], imports: [ BrowserModule, FormsModule, HttpModule, MaterialModule ], providers: [ {provide: HTMLAudioElement, useFactory: createAudioElement}, // TODO use something more generic than HTMLAudioElement {provide: 'AudioContext', useFactory: 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 { }