Coder Social home page Coder Social logo

elm-monitor's Introduction

screenshot

This project is a PWA and works even w/o stylesheets (just the infos then) and w/o JS (no offline capabilities then).

Local development

Start a development server with e.g.:

$ npx live-server

Deployment on Now

$ ./deploy.sh

Needs workbox and now installed globally.

elm-monitor's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

christophp

elm-monitor's Issues

Error when trying to use union type as message

I think it has to do with msg being the unit type.

type alias Model_ =
    { array : Array Int
    }


type Msg_
    = Blah


main : Program () Model_ Msg_
main =
    Monitor.sandbox
        { init = { array = Array.fromList [ 5 ] }
        , view = \_ -> Html.button [ Html.Events.onClick Blah ] [ Html.text "produces an error in console" ]
        , update = \_ model -> model
        }

This code works fine, but if I replace Msg_ with () then I get the n is null exception.

Originally posted by @MartinSStewart in #9 (comment)

Model containing "\\" causes parsing to fail

A model containing an escaped backslash will cause elm-monitors parsing to fail.

Here's a simple example

main : Program () String ()
main =
    Monitor.sandbox
        { init = "\\"
        , view = \_ -> Html.button [ Html.Events.onClick () ] [ Html.text "produces an error in console" ]
        , update = \_ model -> model
        }

This occurred in version 0.0.9

Model containing Vec3 (from elm-explorations/linear-algebra) causes parsing to fail

The following code will generate an error in the console when clicking the button. Note that the error is not generated if Vec3 is removed from the model.

module Main exposing (main)

import Math.Vector3 as Vec3
import Monitor
import Html exposing (Html)
import Html.Events

type Msg_
    = Msg_ 


type alias Model_ =
    { v : Vec3.Vec3
    }


main : Program () Model_ Msg_
main =
    Monitor.sandbox
        { init =
            { v = Vec3.vec3 0 0 0
            }
        , view = \_ -> Html.button [ Html.Events.onClick Msg_ ] [ Html.text "produces an error in console" ]
        , update = \_ model -> model
        }

Fails to parse custom type with space character

The following code prints the error Expecting Variable at row 1, col 25 in the console

type alias NewModel =
    { aField : SomeType
    }

type SomeType
    = WithChar Char

main : Program Flags NewModel MsgBase
main =
    Monitor.element
        { init = \_ -> ({ aField = WithChar ' '}, Cmd.none)
        , view = \_ -> Html.div [] []
        , update = \_ model -> (model, Cmd.none)
        , subscriptions = \_ -> Sub.none
        }

The output elm-monitor output looks like this [Monitor:init]: { aField = WithChar (' ') }.

Edit: I'm using version 0.0.11

Console gets spammed with exceptions

After setting up elm-monitor I get the following exception in the console repeatedly

Expecting Keyword False at row 1, col 1
Expecting Symbol () at row 1, col 1
Expecting Symbol ' at row 1, col 1
Expecting Symbol " at row 1, col 1
Expecting Symbol < at row 1, col 1
Expecting { at row 1, col 1
Expecting [ at row 1, col 1
Expecting Keyword True at row 1, col 116
Expecting Keyword False at row 1, col 116
Expecting Symbol () at row 1, col 116
Expecting Symbol ' at row 1, col 116
Expecting Symbol " at row 1, col 116
Expecting Symbol < at row 1, col 116
Expecting { at row 1, col 116
Expecting [ at row 1, col 116
Expecting Symbol ( at row 1, col 116
Expecting Variable at row 1, col 116
Expecting Number at row 1, col 116
Expecting Variable at row 1, col 1
Expecting Number at row 1, col 1

I've used elm-monitor with another Elm project and I haven't seen the exception there. I'm not sure what the difference is that causes it to appear here. This exception appears both on Firefox and Chrome.

Edit: The frequency of these exceptions seems to match when a certain Elm msg is received. In case it helps, this is what elm-monitor writes out for that msg

(LongPollRequest (Err NetworkError),{ currentTime = Posix 1551788676113, hideErrorOverlay = False, lastMessageId = -1, messages = [], quietForOneSecond = Debouncer (Config { accumulator = <function>, emitWhenUnsettled = Nothing, emitWhileUnsettled = Nothing, settleWhenQuietFor = Just 1000 }) Settled, releaseBuilds = Loading, serverData = Failure NetworkError, uploadTimeRequest = Nothing })

Record field containing "\"" causes parsing to fail

If the model has a string field with the text \" in it then

Expecting Keyword True at row 1, col 1
Expecting Keyword False at row 1, col 1
Expecting Symbol () at row 1, col 1
Expecting Symbol ' at row 1, col 1
Expecting Symbol " at row 1, col 1
Expecting Symbol < at row 1, col 1
Expecting { at row 1, col 1
Expecting [ at row 1, col 1
Expecting , at row 1, col 386
Expecting } at row 1, col 386
Expecting Variable at row 1, col 1
Expecting Symbol - at row 1, col 1
Expecting Number at row 1, col 1

gets printed to the console on every update.

Edit: So for example, type alias Model = { someText : String} and initialModel = { someText = "\""}

Edit2: This occurred in version 0.0.8

Updates containing a message with no parameters throws an exception

Steps to reproduce:

  1. Create a new project with elm-monitor hooked up
  2. Add a button that sends off a message with no parameter (i.e. NoOp)
  3. Notice that when you click the button the following error appears
    image
  4. Notice that if you add a parameter to your message (i.e. NoOp Int) the error no longer appears.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.