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

@bitdrift/electron

v0.2.1

Published

Electron support of the bitdrift SDK

Readme

@bitdrift/electron

Overview

This is the package containing the Electron support for bitdrift. See https://docs.bitdrift.io for more information.

Installation

npm install @bitdrift/electron

Usage

import {
  init,
  info,
  SessionStrategy,
  getSessionID,
  generateDeviceID,
} from '@bitdrift/electron';

// Initialize the bitdrift SDK. This is expected to be called from the main process.
init('<api-key>', SessionStrategy.Activity);

// Send a custom log message at info level. Other log levels are trace, debug, warn, and error.
// This is expected to be called from the main process.
info('Hello, world!');

// Get the current session ID. See https://docs.bitdrift.io/sdk/features#session-management for more information about session management.
const sessionID = getSessionID();

// Generate a new device ID that can be used with the `devicecode` operator in bd tail. See https://docs.bitdrift.io/cli/quickstart.html#log-tailing for more information.
const deviceID = generateDeviceID();

Quick Start

During initialization, additional options may be passed to allow for automatic registration of an electron main channel:

// Initialize auto registration of channel listeners with default settings.
init('<api-key>', SessionStrategy.Activity, {
  autoAddMainListener: true,
});

// Initialize auto registration of channel listeners with custom settings.
init('<api-key>', SessionStrategy.Activity, {
  autoAddMainListener: {
    channelPrefix: 'my-channel',
  },
});

These options will register main channel listeners for bitdrift:log, or if a custom channel prefix is provided, <channelPrefix>:bitdrift:log.

To expose the bitdrift SDK to the renderer process, the initRenderer function can be called from the renderer process:

import { initRenderer } from '@bitdrift/electron/renderer';

// Initialize with defaults.
initRenderer({
  autoExposeInMainWorld: true,
});

// Initialize with custom settings.
initRenderer({
  autoExposeInMainWorld: {
    exposeAs: 'logger',
    channelPrefix: 'my-channel',
  },
});

This will expose the bitdrift SDK to the renderer process as window.bitdriftSDK, or if a custom exposeAs value is provided, window.<exposeAs>.

NOTE: The channel prefix must match the prefix used in the main process for the main channel listeners to work correctly.

Experimental Session Replay

Session replay is an experimental feature that allows you to replay user sessions in the browser. To enable session replay, you must initialize the bitdrift SDK with the experimental options for session replay set.

In the main process:

init('<api-key>', SessionStrategy.Activity, {
  autoAddMainListener: {
    experimental: {
      sessionReplayEnabled: true
    }
  }
});

This will register main channel listeners for bitdrift:replay, or if a custom channel prefix is provided, <channelPrefix>:bitdrift:replay.

In the renderer process:

// Initialize with defaults.
initRenderer({
  autoExposeInMainWorld: true,
  experimental: {
    sessionReplayConfiguration: true
  }
});

// Initialize with custom settings.
initRenderer({
  autoExposeInMainWorld: true,
  experimental: {
    sessionReplayConfiguration: {
        frequency: 6000, // The interval in milliseconds at which to capture the screen and send it to the main process.
    }
  }
});

With each of these options enabled, the bitdrift SDK will periodically capture the screen and send it ot the main process. These screens can then be viewed with the flushed session in the bitdrift timeline view. Similar to on mobile, this captures a privacy-safe wireframe of the screen, not the actual content.

NOTE: For session replay to work correctly, both the main and renderer processes must be initialized with the experimental session replay options.