npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

app-state-inspector

v0.1.2

Published

Live overlay panel for inspecting/debugging application state

Downloads

3

Readme

App State Inspector

A simple overlay panel that gives a live view into the application state. The goal is to make it easier to find the problematic logic when your app isn't behaving as you expected.

It may also be useful when building components, as it can provide lower friction visibility into the state of intermediate variables.

App State Inspector was designed to work with mithril.js apps out of the box. It should be pretty easy to make it work well with other frameworks, but this hasn't happened yet.

Usage

Install

> npm install app-state-inspector --save-dev

Include the file app-state-inspector.css when developing.

Configure

// init.js
import m from 'mithril';
import App from 'app';

m.mount(document.body, App);

import Inspector from 'app-state-inspector'
Inspector.mount();

Usage

// app.js
import m from 'mithril';
import Inspector from 'app-state-inspector'

export default {
  controller: function() {
    this.num = 1;
    var self = this;
    this.increment = function() { this.num++; }
    this.decrement = function() { this.num--; }
  },
  view: function(ctrl) {
    Inspector.set('number', ctrl.num);
    Inspector.set('fizz',      ctrl.num % 3 === 0);
    Inspector.set('buzz',      ctrl.num % 5 === 0);
    Inspector.set('fizz-buzz', ctrl.num % 15 === 0);

    return m('div', [
      m('h1', 'Fizz Buzz'),
      m('.button-row', [
        m('button', { onclick: ctrl.increment }, 'plus 1'),
        m('button', { onclick: ctrl.decrement }, 'minus 1')
      ])
    ]);
  }
};

Documentation

Inspector.set(key, value)

Add (or replace) a row in the overlay panel. key must be a unique string. This method will overwrite any previous value stored at the same key.

Inspector.delete(key)

Remove a row from the overlay panel.

Inspector.clear()

Clear all rows.

Inspector.mount([opts])

Mount the overlay panel onto the DOM. This should be called only once, when the application loads.

opts (not required)

{
  // Specifies the placement of the overlay panel in the viewport.
  // These are mutually exclusive. The panel can only be in one corner at a time.
  // default -> topRight: true
  topLeft:      Boolean
  topRight:     Boolean
  bottomLeft:   Boolean
  bottomRight:  Boolean

  // Sets the overlay panel to be collapsed on page load.
  // default -> false
  isCollapsed:  Boolean
}

Run the demo

> cd node_modules/app-state-inspector
> npm install
> npm run build:demo

Then you can open demo/index.html in your browser. You should see something similar to the screenshot below

App Inspector demo