debugging - 是否可以在使用 elm reactor 时显示 Elm 的调试器?

标签 debugging elm

使用时 elm reactor ,它工作得很好,但似乎没有提供一种显示调试器的方法,以在每次更新后明确查看模型的状态。
elm reactor --debug不起作用,我在 UI 中没有看到选项,也没有在 the documentation 中看到它的提及.

我们可以在使用 elm reactor 时看到调试器吗? ?

这是在 Reactor 中运行但不显示调试器的代码示例(使用 Elm 0.19 时)

module Main exposing (main)

import Browser
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)


type alias Model =
    { count : Int }


initialModel : Model
initialModel =
    { count = 0 }


type Msg
    = Increment
    | Decrement


update : Msg -> Model -> Model
update msg model =
    case msg of
        Increment ->
            { model | count = model.count + 1 }

        Decrement ->
            { model | count = model.count - 1 }


view : Model -> Html Msg
view model =
    div []
        [ button [ onClick Increment ] [ text "+1" ]
        , div [] [ text <| String.fromInt model.count ]
        , button [ onClick Decrement ] [ text "-1" ]
        ]


main : Program () Model Msg
main =
    Browser.sandbox
        { init = initialModel
        , view = view
        , update = update
        }

最佳答案

elm reactor 不再包含调试器在 0.19。它在重构时显然已被删除(尽管将来可能会重新添加)。

现在,我建议使用 elm-live它还支持自动重新加载。

关于debugging - 是否可以在使用 elm reactor 时显示 Elm 的调试器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54103120/

相关文章:

apache - 如何调试 REDIS,APACHE 发布 Docker 容器?

c++ - 在不增加内存的情况下逐渐增加 cpu 使用率。想法?

clipboard - 榆树:将文本复制到剪贴板

json - 如何通过 Elm 端口传递联合类型?

elm - 在 Elm 中上传文件

c++ - VS2010 RC - 调试器中只有 100 个 std::map 元素

在 VS Code : Breakpoints Move 中调试 Jest 测试

iphone - 我可以将专为 iOS 模拟器构建的应用程序安装到第二个模拟器上吗?

Elm 模态对话框

elm - 在 elm 中,除了最后一个值之外,如何将值作为参数传递给函数?