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

fe-supervisor

v0.1.14

Published

The frontend monitor project

Downloads

106

Readme

fe-supervisor (The frontend monitor project)

NPM downloads npm version Build Status codecov install size license

Quick Start

Several options to get up and running:

  • Clone the repo: git clone [email protected]:BobbyLH/fe-supervisor.git
  • Install with npm: npm install fe-supervisor -S
  • Install with Yarn: yarn add fe-supervisor
<script src=`${pathTo}/dist/fe-supervisor.sdk.${version}.js` ></script>
<script>
    console.log($sv.getTiming())
</script>
import sv from 'fe-supervisor'

console.log(sv.getMemory())

API

Global NameSpace

$sv

Methods

getPerformanceData(config)

Get the all performance data.

import sv from 'fe-supervisor'

sv.getPerformanceData().then(data => console.log(data))
interface IconfigSources {
  [propName: string]: string[];
}

interface config {
  apiRatio?: number;
  sourceRatio?: number;
  apis?: string[] | string;
  sources?: IconfigSources | string[] | string;
  timeout?: number; // timeout threshold(millisecond) - default 2000
  whitelist?: Iwhitelist;
  paintTiming?: boolean;
}

getMemory()

Get memory consumption.

getTiming()

Get performance timing.

getSource(config)

Get source timing.

import sv from 'fe-supervisor'

sv.getSource().then(data => console.log(data))
interface IconfigSources {
  [propName: string]: string[];
}

interface config {
  apiRatio?: number;
  sourceRatio?: number;
  apis?: string[] | string;
  sources?: IconfigSources | string[] | string;
  timeout?: number; // timeout threshold(millisecond) - default 2000
  whitelist?: Iwhitelist;
  paintTiming?: boolean;
}

mark(tag)

Marking a tag in the code.

getExecTiming()

Get tagged code execution timing.

import sv from 'fe-supervisor'

sv.getExecTiming().then(data => console.log(data))

clearPerformance()

Clear performance data.

observeSource(target, callback, option?: IobserveSourceOption)

get source timing information by refer dom.

import sv from 'fe-supervisor'

const sec = document.querySelect('section')
sv.observeSource(sec, function (source) {
  console.log('source', source)
}, {
  sourceType: ['script', 'img', 'link']
})
interface IobserveSourceOption {
  sourceType?: string | string[];
  timeout?: number;
  whitelist?: Iwhitelist;
}

getEnvInfo()

Get browser environment information.

getError(errType)

Get errors information.

type errType = 'js' | 'api' | 'source'

setError(error)

Set error.

interface error {
  type: ExceptionType;
  sourceType?: string;
  url: string;
  [propName: string]: any;
}

makeTrackInfo(type, info)

Making a track infomation.

observeError(target, callback?, observeDom?)

obersevation appoint target's children error.

import sv from 'fe-supervisor'
import React from 'react'



export default class Detail extends React.PureComponent{
  constructor (props) {
    super(props)
    this.pool = React.createRef()
  }
  addImg () {
    // observer DOM
    $sv.observeError(pool, function (errObj) {
      console.log('errObj', errObj)
    })
    // api request
    this.setState({
      Imgs: data
    })
  }

  getError () {
    const errObj = sv.getError('source')
    console.log(errObj)
  }

  render () {
    const { Imgs = null } = this.state
    return (
      <div ref={this.pool}>
        <button onClick={this.addImg.bind(this)}>Load Image</button>
        { Imgs }
        <button onClick={this.getError.bind(this)}>Get Error Message</button>
      </div>
    )
  }
}
type target = HTMLElement
type observeDom = string | string[]

License

Copyright (c) 2019-2019 Bobby.li

Released under the MIT License