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

@senstate/client

v0.3.0

Published

[![NPM Version][client-npm-img]][client-npm-url] [![Package Size][client-size-img]][client-size-url] [![Known Vulnerabilities][client-snyk-img]][client-snyk-url]

Downloads

8

Readme

@senstate/client TS Client

NPM Version Package Size Known Vulnerabilities

npm install @senstate/client

This library contains the JS/TS client code.

Connect to Senstate (@senstate/client-connection)

NPM Version Package Size Known Vulnerabilities

npm install @senstate/client-connection

import {setSenstateConnection} from "@senstate/client-connection";

setSenstateConnection({
  name: 'My Example App',
  // appId: 'customShortId' optional
}  /* , ws://localhost:3333 */);

// second parameter is a custom hub-address, working locally you won't need to change this

Without calling setSenstateConnection all watchers/senders won't send anything to the Dashboard.

Low-Level Senders

Those methods sending the data to the hub:

| |Watch|Log|Error| |--- |--- |--- |--- | |Function|Send the current value of a "tag"|Sends a log entry to the Hub|Subscribes to the window.onerror method, and send this to the Hub| |Create|const watcher = createWatchSender({tag: string, group?: string, type?: WatchType})|const logger = createLogSender(logLevel: LogLevel = LogLevel.Info, logName?: string)| registerWindowErrorHandler() | | | |const otherLogger = genericLogSender() | | |Send Data|watcher(value) |logger(logMessage, data?, line?)| Once an error happened it'll be sent | | | |otherLogger(GenericLogSenderArgs) (full params, use code completion :)) | |

Measure Utils

TimeMeasurer uses the time between .start() and .stop as value for the internal Watcher

  const time = new TimeMeasurer({tag: string, group?: string});
  time.start();
  // your work
  time.step();  // step can be called often, to get multiple updates, if called in a loop

Decorators

Add @PropertyWatcher({tag: string, group?: string}) to your class-property, it uses a watcher internally to send the data

  @PropertyWatcher()
  public watchProperty = 0;

  @PropertyWatcher({tag: 'otherKey', group: 'Important'})
  public watchOtherProperty = 0;

more to be added

Promise() Helpers

Measure the time of a promise, and send the value

const result = await measurePromise({tag: string, group?: string}, () => myPromiseFunc());

RXJS Pipes

import { SenstateOperators } from '@senstate/client';

myObservable$.pipe(
   SenstateOperators.watch({tag: 'Watcher Tag', group: 'optional'}), // Watcher
)

other$.pipe(
   SenstateOperators.log('Log Name')
)

const time = new TimeMeasurer({tag: 'Measurer Tag', group: 'optional'});

trigger$.pipe(
   SenstateOperators.measureStart(time),
   mergeMap(() => longerObservableExecution$),
   SenstateOperators.measureStep(time)
)