m-mullins/elm-console/1.0.1

Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: github.com/m-mullins/elm-console is gone (deleted or private); Software Heritage has not archived the repo; no fork with tag 1.0.1 found (17 same-name repos checked); no cached copy. Use another version.

Details

ELM Console

Wrap JS console in an elm module.

  • Used for testing out 0.19 native modules.
  • Requires modified 0.19.0 elm compiler for native modules

Examples

  • Not sure if any of these examples actually make sense,

  • Ideally we should be striving to have code that does not have state that require logging?

  • Console.log

addTen : Int -> Int
addTen arg =
    let
        _ = Console.log ("In myfunc" String.fromInt arg) arg
    in
        p + 10
  • Console.warn
checkApiResponse : Data -> Int -> Data -> Data
checkApiResponse currentData status newData =
    case status of
        200 -> newData
        _ -> 
            let
                warnStr = "Unexpected api response: " ++ String.fromInt s
            in
                Console.warn warnStr currentData
  • Console.error
toValidMonth : Int -> Result Int Int
toValidMonth month =
    if month >= 1 && month <= 12
        then Ok month
        else Console.error "invalid month" month |> Err
  • Console.time
init : ...
init ... =
    let
        timeInit = Console.time "updates" ()

update : ...
update ... = 
    let
        timeCheck =  Console.timeLog "updates" ()