Socket
Book a DemoInstallSign in
Socket

elm-monitor

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elm-monitor

Monitor your elm program with redux-devtools

latest
Source
npmnpm
Version
0.0.14
Version published
Maintainers
1
Created
Source

elm-monitor

Monitor your elm program with redux-devtools during development. It's really just for monitoring and inspecting state and actions. Action replay (time travel) is not supported.

Screenshot Redux Devtools

How to use it?

  • Install the dependency: $ npm install elm-monitor

  • Import and initialize elm-monitor in your index.js:

    import monitor from 'elm-monitor';
    ...
    monitor();
    
  • Copy or symlink Monitor.elm into your source folder, via e.g. ln -s ../node_modules/elm-monitor/src/Monitor.elm src

  • Import Monitor.elm into your Main.elm with import Monitor

  • Replace Browser.application with Monitor.application in your Main.elm

  • Open Redux Devtools in your browser and reload your app.

Attention!

You should only use this during development. Elm won't build when Monitor.elm is used, because it depends on Debug.log.

What if I don't use Browser.application?

Besides being able to monitor Browser.application, Monitor.elm additionally exports:

  • Monitor.worker - when using Platform.worker
  • Monitor.sandbox - when using Browser.sandbox
  • Monitor.element - when using Browser.element
  • Monitor.document - when using Browser.document

How does it work under the hood?

It's quite simple. Monitor.elm just logs the state on init as well as every action and resulting state on update to the browser console. monitor.js connects to redux-devtools, patches console.log to extract messages logged by Monitor.elm, parses and transforms the log messages using elm/parser (thx @ChristophP) and passes them over to redux-devtools.

How does it map Elm to JS data structures?

  • Int, Float -> Number
  • Char, String -> String
  • Unit () -> null
  • List -> Array
  • Tuple -> Array
  • Type constructor -> Array [⟨Ctor⟩, param1, param2] or String ⟨Nothing⟩

Keywords

elm

FAQs

Package last updated on 01 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.