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

tinyprofiler-client

v0.0.5

Published

shared client for tinyprofiler, a minimal JavaScript profiler

Downloads

8

Readme

tinyprofiler-client

shared client for tinyprofiler, a minimal JavaScript profiler

introduction

This package contains the shared client code for tinyprofiler. Use this as part of your front-end environment to manage reporting of profiles. The one thing this package doesn't do is construct markup, for that you'll need to install one of the UI pacakges.

getting started

First set up tinyprofiler server-side. You can install this package with the manager of your choice: we support npm (with npm-css or rework-npm for stylesheets), component and bower.

If you wish to profile client-side, create an instance of tinyprofiler and pass it in to the client constructor.

tp = require 'tinyprofiler'
tpClient = require 'tinyprofiler-client'

profiler = tp(options)
client = tpClient(profiler, options)

If you're only profiling server-side you can just create the client passing only the options hash.

tpClient = require 'tinyprofiler-client'

client = tpClient(options)

Now go get a UI package for the view engine of your choice!

UI packages

At the moment the only UI implementation is:

The rationale for splitting the front-end code is to make it easier for applications to tightly integrate tinyprofiler into their existing stack. If your front-end framework isn't represented in the above list, you are invited to create a package to generate markup and submit a pull request to list it here.

documentation

  • browser bundling
  • markup specification
  • API reference

browser bundling

No matter how you develop your app, no matter what libraries or frameworks you use, you should be bundling before deploying to production. tinyprofiler is built as a CommonJS module, so that it can be loaded identically on the server in Node.js as well as on the client with Browserify or another compatible tool. We recommend you do the same with your app.

tinyprofiler-client also includes shared CSS. Packaging CSS over NPM is still an emerging field, but npm-css and rework-npm provide compatible implementations utilizing the standard @import statement. We also provide bower.json and component.json files to integrate seamlessly into those build systems.

Worst case, you can load the stylesheet explicitly from the node_modules folder. The stylesheet to load is specified in the package.json file under the style key. Currently the path is lib/index.css.

If you have another package or build system you'd like us to handle, we welcome pull requests to add additional support.

markup specification

nothing yet

events

tinyprofiler-client emits an event called profile every time it gets a new complete request profile, no matter what the source is. The profile is included as the payload of the event. It is preferred that UI packages listen for this event to rerender themselves.

API reference

tinyprofilerClient( [profiler], [options] )

Create a new tinyprofiler-client. profiler is an instance of tinyprofiler for local profiling. options is a hash of options. Both are optional.

The options accepted are:

headerName: "X-TinyProfiler-Ids"
maxProfiles: 20
monkeyPatch: yes
path: "tp"
headerName

the name of the HTTP header to use to receive profile ids

maxProfiles

the maximum number of old profiles to hold on to.

monkeyPatch

do we automatically monkey patch the XHR object?

path

server path where tinyprofiler REST API is mounted

fetch( id )

Fetch the profile with the given id from the server to make it available locally.

getById( id )

Get the profile with the given id from the local cache.

getRequests()

Get all profiles held locally.

remove( id )

Remove the given profile from the local store.

license

MIT: https://couch.mit-license.org/

╭╮☲☲☲╭╮