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

ryandi-eagle-eye

v0.1.1

Published

Eagle Eye JS

Downloads

1

Readme

@tiket/react-common-eagle-eye

This library will be baked into @tiket/react-common-fetch and (in Next.js projects) lib/fetch. So you likely don’t need/want to implement manually in your project.

Library that interfaces with JSI (exposed by native app to WebView) to log the performance and other metrics of fetch requests.

Currently only supports WebView (window.native.logWebApi to be specific).

Usage

import EagleEye from '@tiket/react-common-eagle-eye';

const exampleFetch = async () => {
  const url = 'https://tiket.com/api/something?param=hello';
  const method = 'POST';
  const headers = {
    exampleKey: 'exampleValue',
  };
  // no body in case of GET
  const body = {
    name: 'hello',
  };

  const eagleEye = EagleEye({
    url,
    method,
    headers,
    body,
    gql: true, // in case of Apollo Client (see GraphQL section below)
  });
  eagleEye.start();

  try {
    const res = await fetch(url, {
      method,
      headers,
      body: JSON.stringify(body),
    });

    // capture the successful fetch
    eagleEye.onFetchSuccess(res);

    // and return the response as is
    return res;
  } catch (e) {
    // capture the failed fetch
    let errorMessage = '';

    if (e instanceof Error) {
      errorMessage = e.message;
    }

    eagleEye.onFetchException(errorMessage);

    // and throw the error as is
    throw e;
  }
};

GraphQL

Only supports Apollo Client for now, if you use other clients such as urql, please let core team know.

In case of GraphQL, the url doesn’t provide much value, hence this library needs to extract information out of the request body.

Passing gql: true will make this library extract operationName out of the request body.