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! ✨
var choo = require('choo')
var app = choo()
if (process.env.NODE_ENV !== 'production') {
app.use(require('choo-devtools')())
}
app.mount('body')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, timingand should returntrue(the event will be logged) orfalse(the event wont be logged).
Print out information about all commands.
❯ choo.helpLog out the Choo state object.
❯ choo.stateLog 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 = falseLog out information about the browser's storage capabilities.
❯ choo.storageLog 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.logTo 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.
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')Get an array with the registered routes.
❯ choo.routesLog out performance metrics for Choo. There are different types of entries we can show:
choo.perf.allLog out all data.choo.perf.coreOnly log out data about Choo's built-in methods.choo.perf.eventsOnly log out information about the event bus.choo.perf.componentsOnly log out information about components.