This applies to knitting 0.16 (and earlier), in knitting 0.17 subscriptions were changed to ports
To send a signal to the mailbox from the update, you need to use it StartApp, unlike StartApp.Simple, since the first one allows you to use effects in the function update.
, , , , No-Op :
type Action
= NoOp
| SendRequest String
update - SendRequest. StartApp, , Effects.task, , , Action, Task.succeed NoOp.
update action model =
case action of
NoOp ->
(model, Effects.none)
SendRequest str ->
let
sendTask =
Signal.send requestPalette.address str
`Task.andThen` (\_ -> Task.succeed NoOp)
in
(model, sendTask |> Effects.task)
click address, :
[ on "input" targetValue (Signal.message address << SendRequest) ]
. request javascript, .