changeset 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 332073276015
files src/app/app.module.ts
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/app/app.module.ts	Thu Feb 23 22:15:52 2017 +0000
+++ b/src/app/app.module.ts	Thu Feb 23 22:20:56 2017 +0000
@@ -19,6 +19,10 @@
   )();
 }
 
+export function createAudioElement(): HTMLAudioElement {
+  return new Audio();
+}
+
 @NgModule({
   declarations: [
     AppComponent,
@@ -34,8 +38,8 @@
     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
+    {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'}