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

theroomjs

v2.1.6

Published

a vanilla javascript plugin that allows you to outline dom elements like web inspectors

Downloads

3,573

Readme

theroomjs

A vanilla javascript plugin that allows you to outline DOM elements like web inspectors.

Downloads install size

theroomjs can be accessable globally as theRoom. It's compatible with modern browsers such as Google Chrome, Mozilla Firefox, Safari, Edge and Internet Explorer.

Install

$ npm install theroomjs --save

Usage

  // setup/configure theRoom before inspection
  // this configurations can be passed in 'start' event as well
  window.theRoom.configure({
    inspector: '.inspector-element',
    blockRedirection: true,
    excludes: ['footer'],
    click: function (element) {
      console.log('element is clicked:', element)
    }
  })

  // start inspection
  window.theRoom.start()

  // dynamically bind event
  window.theRoom.on('mouseover', function (element) {
    console.log('the element is hovered', element)
  })

  // stop inspection
  // and reset inspector styles
  window.theRoom.stop(true)

  // dont emit mouseover and click events
  // if the target element id is 'yusufHayaloglu'
  window.theRoom.on('hook', function (event) {
    if (event.target.id === 'yusufHayaloglu') {
      return false
    }
  })

  console.log(
    window.theRoom.status() // will print out -> stopped
  )

Options

| Name | Type | Default | Description | | --- | --- | --- | --- | | inspector | string or DOM node | - | Placeholder element for inspection. It will not be inspected | | createInspector | boolean | false | If true and inspector option is not provided, theRoom will try to create an inspector element whose class is inspector-element for you and will be appended to <body/> | | htmlClass | boolean | true | If true theRoom's namespace will be automatically added to <html/> element class list | | blockRedirection | boolean | false | If true the page will not be redirected elsewhere. theRoom will override onbeforeunload to do that | | excludes | array (string) | - | Elements that excluded for inspection. Basic CSS selectors are allowed. For more information please see document.querySelector |

Events

| Name | Description | | --- | --- | | starting | Fired when inspection is being started | | started | Fired when inspection is started | | stopping | Fired when inspection is being stopped | | stopped | Fired when inspection is stopped | | click | Fired when the inspected element is clicked. The element is passed as the first argument, Event passed as the second argument | | mouseover | Fired when the inspected element mouseovered. The element is passed as the first argument, Event passed as the second argument | | hook | Fired before click and mouseover events. Event passed as the only argument. mouseover and click events wont be emitted if the hook event returns false |

Events can also be defined in options.

theRoom object

theRoom global object exposes those:

| Option | Type | Parameters | Description | | --- | --- | --- | --- | | on | function | event name and handler function | To dynamically event binding | | start | function | options (optional) | To start inspection | | stop | function | resetInspector (optional) | To stop inspection | | configure | function | options | To override theRoom option(s) anytime | | status | function | - | Gets inspection engine status. Can be idle, running and stopped |

Related projects

  • path-finder - A Chrome extension to inspect and find out an HTML element unique CSS selector