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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ts-ecg-webviewer

v1.0.0

Published

Framework-agnostic HTML5 Canvas ECG Web Viewer

Downloads

33

Readme

ts-ecg-webviewer

A framework-agnostic, zero-runtime-dependency ECG web viewer built with TypeScript and the HTML Canvas API.

ts-ecg-webviewer supports buffered asynchronous data loading, smooth playback, timeline navigation, zooming, fullscreen viewing, and PNG snapshots. It can be used from plain TypeScript or integrated into frameworks such as Angular and React.

This package is a visualization component, not a certified medical device.

ts-ecg-webviewer Angular demo

Features

  • TypeScript-first API with bundled declarations
  • ESM and CommonJS builds
  • No runtime dependencies
  • Buffered asynchronous sample loading
  • Two ECG leads: I and aVF
  • Playback speed control from 0.5x to 5x
  • Timeline seeking and mouse-wheel navigation
  • Zoom, fullscreen, and PNG export
  • High-DPI canvas rendering
  • Framework-agnostic lifecycle

Installation

npm install ts-ecg-webviewer

Import the viewer and its stylesheet:

import { TsEcgWebViewer } from "ts-ecg-webviewer";
import "ts-ecg-webviewer/styles.css";

Example applications

Both example applications are available in the source repository. They are not included in the installed npm package.

Clone the code repository and install its dependencies:

git clone https://github.com/lumyslinski/ts-ecg-webviewer.git
cd ts-ecg-webviewer
npm ci

Angular example

Source: examples/angular-demo.

From the cloned repository root, run:

npm run start --workspace=examples/angular-demo

Open http://localhost:4200.

React/Next.js example

Source: examples/react-demo.

From the cloned repository root, create the local environment file:

Copy-Item examples/react-demo/.env.example examples/react-demo/.env.local

On macOS or Linux, use:

cp examples/react-demo/.env.example examples/react-demo/.env.local

Then start the React demo:

npm run dev --workspace=examples/react-demo

Open http://localhost:3000.

The local test account is documented in the React demo README.

Data format

fetchSamples receives a zero-based sample position and requested sample count. It must resolve to:

interface TsEcgWindow {
  startSample: number;
  sampleCount: number;
  leads: {
    I: number[];
    aVF: number[];
  };
}

The returned window may contain additional buffered samples. Overlapping requests should return identical values for the same sample positions to avoid visible discontinuities during playback.

Constructor options

| Option | Type | Description | | -------------- | ------------------------------------------------------ | ------------------------------------- | | sampleRateHz | number | Positive recording sample rate. | | totalSamples | number | Total available sample count. | | durationSec | number | Total recording duration in seconds. | | fetchSamples | (startSample, count) => Promise<TsEcgWindow \| null> | Loads a sample window asynchronously. |

Public API

The package exports:

  • TsEcgWebViewer
  • TsEcgRenderer
  • TsEcgWebViewerOptions
  • TsEcgRendererOptions
  • TsEcgWindow

Call viewer.destroy() when unmounting to stop animation, disconnect resize observation, and remove generated UI elements.

Framework integrations

The repository contains complete examples:

Browser support

The viewer requires a modern browser with:

  • HTML Canvas 2D
  • ResizeObserver
  • requestAnimationFrame
  • Fullscreen API for the fullscreen control

Links

License

MIT © 2026 Lukasz Myslinski