diff --git a/js/index.js b/js/index.js index fb14b639..9bdb6420 100644 --- a/js/index.js +++ b/js/index.js @@ -27,6 +27,7 @@ import { SET_EQ_AUTO, SET_DUMMY_VIZ_DATA } from "./actionTypes"; +import { loadFilesFromReferences } from "./actionCreators"; import { skinUrl as configSkinUrl, @@ -280,6 +281,16 @@ Raven.context(() => { enableMediaSession(webamp); + const fileInput = document.createElement("input"); + fileInput.id = "webamp-file-input"; + fileInput.style.display = "none"; + fileInput.type = "file"; + fileInput.value = null; + fileInput.addEventListener("change", e => { + webamp.store.dispatch(loadFilesFromReferences(e.target.files)); + }); + document.body.appendChild(fileInput); + webamp.renderWhenReady(document.getElementById("app")); // Expose webamp instance for debugging and integration tests. diff --git a/js/webampLazy.js b/js/webampLazy.js index 7f9ce92d..afa67286 100644 --- a/js/webampLazy.js +++ b/js/webampLazy.js @@ -11,7 +11,6 @@ import { setSkinFromUrl, loadMediaFiles, setWindowSize, - loadFilesFromReferences, play, pause, seekBackward, @@ -93,18 +92,6 @@ class Winamp { type: navigator.onLine ? NETWORK_CONNECTED : NETWORK_DISCONNECTED }); - if (true) { - const fileInput = document.createElement("input"); - fileInput.id = "webamp-file-input"; - fileInput.style.display = "none"; - fileInput.type = "file"; - fileInput.value = null; - fileInput.addEventListener("change", e => { - this.store.dispatch(loadFilesFromReferences(e.target.files)); - }); - document.body.appendChild(fileInput); - } - if (zIndex != null) { this.store.dispatch({ type: SET_Z_INDEX, zIndex }); }