comparison 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
comparison
equal deleted inserted replaced
93:8f2b2aed0df1 94:edddb2a5cf10
17 (window as any).AudioContext 17 (window as any).AudioContext
18 || (window as any).webkitAudioContext 18 || (window as any).webkitAudioContext
19 )(); 19 )();
20 } 20 }
21 21
22 export function createAudioElement(): HTMLAudioElement {
23 return new Audio();
24 }
25
22 @NgModule({ 26 @NgModule({
23 declarations: [ 27 declarations: [
24 AppComponent, 28 AppComponent,
25 WaveformComponent, 29 WaveformComponent,
26 AudioFileOpenComponent, 30 AudioFileOpenComponent,
32 FormsModule, 36 FormsModule,
33 HttpModule, 37 HttpModule,
34 MaterialModule 38 MaterialModule
35 ], 39 ],
36 providers: [ 40 providers: [
37 {provide: HTMLAudioElement, useValue: new Audio() }, // TODO use something more generic than HTMLAudioElement 41 {provide: HTMLAudioElement, useFactory: createAudioElement}, // TODO use something more generic than HTMLAudioElement
38 {provide: 'AudioContext', useValue: createAudioContext()}, // use a string token, Safari doesn't seem to like AudioContext 42 {provide: 'AudioContext', useFactory: createAudioContext}, // use a string token, Safari doesn't seem to like AudioContext
39 AudioPlayerService, 43 AudioPlayerService,
40 FeatureExtractionService, 44 FeatureExtractionService,
41 {provide: 'PiperRepoUri', useValue: 'assets/remote-plugins.json'} 45 {provide: 'PiperRepoUri', useValue: 'assets/remote-plugins.json'}
42 ], 46 ],
43 bootstrap: [AppComponent] 47 bootstrap: [AppComponent]