Git Product home page Git Product logo

choo-devtools's Introduction

choo-devtools stability

npm version build status downloads js-standard-style

Console devtools for Choo. Useful for inspecting the state of applications, tuning performance, and quick iteration. No installation needed means it works in all browsers and Electron! ✨

Usage

var choo = require('choo')

var app = choo()
if (process.env.NODE_ENV !== 'production') {
  app.use(require('choo-devtools')())
}
app.mount('body')

API

var devtoolStore = require('choo-devtools')(opts)

This module exposes a function that return a choo store. The function accept a single option argument, with the following properties:

  • filter: A function to filter events for the devtools logger. The filter function accept three arguments eventName, data, timing and should return true (the event will be logged) or false (the event wont be logged).

Commands

choo.help

Print out information about all commands.

❯ choo.help

choo.state

Log out the Choo state object.

❯ choo.state

choo.debug

Log all state modificiations using object-change-callsite. Logs out the key, value, and stack trace for the change. Useful when you're dealing with unexpected values in your state. Especially useful when enabling asynchronous stack traces in the devtools.

// Enable debugging
❯ choo.debug

// Disable debugging
❯ choo.debug = false

choo.storage

Log out information about the browser's storage capabilities.

❯ choo.storage

choo.log

Log out the last 150 events that occured in Choo. Useful during debugging to quickly figure out which sequences of events were responsible for the current state.

❯ choo.log

To enable state snapshots on each event, call choo.debug. Be warned that this may severely impact performance – it's recommended to only use this for debugging state.

choo.copy([selector])

Serialize the current state to JSON and copy it to the clipboard. Can be passed a selector (such as href) to do a partial copy. Useful if you want to create a test based on the current application state.

// Copy all of state.
❯ choo.copy()

// Copy `state.href`.
❯ choo.copy('href')

choo.routes

Get an array with the registered routes.

❯ choo.routes

choo.perf[type]

Log out performance metrics for Choo. There are different types of entries we can show:

  • choo.perf.all Log out all data.
  • choo.perf.core Only log out data about Choo's built-in methods.
  • choo.perf.events Only log out information about the event bus.
  • choo.perf.components Only log out information about components.

License

MIT

choo-devtools's People

Contributors

yoshuawuyts avatar goto-bus-stop avatar tornqvist avatar ungoldman avatar yerkopalma avatar jakeburden avatar toddself avatar chinedufn avatar frando avatar alamantus avatar

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.