We're learning Elm basics and building a simple application with some audio output with the following setup:
With a signal derived from Time.every the port works (code in ports/audio.js is run). In addition, we get "ping" logs with Debug.log.
port audio : Signal Int
port audio =
Signal.map (always 400) (Time.every Time.second)
|> Signal.map (Debug.log "ping")
However, when we use a signal derived from StartApp's App.model, we get a signal (since "ping" logs with Debug.log are logged) but port to JS doesn't work (code in ports/audio.js is not run)?
port audio : Signal Int
port audio =
Signal.map (always 400) signalDerivedFromStartApp
|> Signal.map (Debug.log "ping")
This might be some basic thing related to Elm signals/ports/StartApp?
Our expert friend found the issue: Our setup was broken since we used Elm.main at two places
Elm.worker(Elm.Main, {});
Elm.fullscreen(Elm.Main)
-> after removing Elm.worker things from audio.js and plugging audio.js to port implementation at index.html things were fixed.
(This is probably not a perfect/final solution for the case but fixed the issue for our current setup)