Herramientas de usuario

Herramientas del sitio


wiki2:elm-programming

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anterior Revisión previa
Próxima revisión
Revisión previa
wiki2:elm-programming [2020/12/19 08:33]
alfred [Flags. Js values on app initialization]
wiki2:elm-programming [2021/05/02 10:06] (actual)
Línea 64: Línea 64:
             in             in
                 ( model, cmd )                 ( model, cmd )
 +</​code>​
 +
 +
 +==== Trigger after one calling ====
 +
 +You can do something like this for sending message ''​UpdateTotals''​ with value 100:
 +<​code>​
 +GetAccount result -> case result of
 +      Ok account -> ({model | account = account }, Task.succeed (UpdateTotals 100.0) |> Task.perform identity)
 +      Err err -> log (toString err) (model, Cmd.none)
 +</​code>​
 +
 +Or just define:
 +<​code>​
 +send : msg -> Cmd msg
 +send msg = Task.succeed msg |> Task.perform identity
 </​code>​ </​code>​
  
Línea 439: Línea 455:
 ==== Create a program without a view ==== ==== Create a program without a view ====
 Use ''​Platform.worker''​. Documentation [[https://​package.elm-lang.org/​packages/​elm/​core/​1.0.5/​Platform#​worker|here]]. Use ''​Platform.worker''​. Documentation [[https://​package.elm-lang.org/​packages/​elm/​core/​1.0.5/​Platform#​worker|here]].
-===== Gotchas ===== 
  
-Every function that accepts two arguments can be converted in one that accepts one argument: 
-<​code>​ 
-> String.repeat 
-<​function>​ : Int -> String -> String 
- 
-> String.repeat 4 
-<​function>​ : String -> String 
-</​code>​ 
wiki2/elm-programming.1608366817.txt.gz · Última modificación: 2020/12/19 09:33 (editor externo)