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

@octanejs/electron

v0.0.30

Published

Electron bindings for the octane renderer — process-split main/preload/renderer helpers and Octane hooks over Electron's IPC and desktop bridge APIs.

Readme

@octanejs/electron

Octane bindings for Electron desktop apps.

Electron is process-split. React apps do not import electron from UI code under contextIsolation; they use main + preload + a bridged API. This package mirrors that layout for Octane:

| Import | Process | Role | | --- | --- | --- | | @octanejs/electron/main | main | Register default ipcMain handlers | | @octanejs/electron/main/native | main | Re-exports Menu, Tray, session, protocol, BrowserWindow, … | | @octanejs/electron/preload | preload | contextBridge expose of Electron IPC + desktop helpers | | @octanejs/electron | renderer | Octane hooks and promise helpers over that bridge |

npm install @octanejs/electron electron octane
pnpm add @octanejs/electron electron octane

Wire-up

// main
import { BrowserWindow, app, clipboard, dialog, ipcMain, nativeTheme, screen, shell } from 'electron';
import {
	registerOctaneElectronMain,
	trackOctaneElectronWindow,
} from '@octanejs/electron/main';

registerOctaneElectronMain({
	ipcMain,
	app,
	dialog,
	shell,
	clipboard,
	nativeTheme,
	screen,
	getWindow: (event) => BrowserWindow.fromWebContents(event.sender as any) ?? undefined,
	getAllWebContents: () => require('electron').webContents.getAllWebContents(),
});

const win = new BrowserWindow({ /* preload … */ });
trackOctaneElectronWindow(win);
// preload
import { contextBridge, ipcRenderer } from 'electron';
import { exposeOctaneElectron } from '@octanejs/electron/preload';

exposeOctaneElectron({ ipcRenderer, contextBridge });
// renderer (.tsrx)
import { useInvoke, useNativeTheme, shell } from '@octanejs/electron';

A custom apiKey must be configured on both sides (preload and renderer are separate realms):

// preload
exposeOctaneElectron({ ipcRenderer, contextBridge, apiKey: 'myElectronAPI' });
// renderer
import { setElectronBridgeKey } from '@octanejs/electron';
setElectronBridgeKey('myElectronAPI');

Hooks

useInvoke(channel, args?, options?)

Runs ipcRenderer.invoke through the bridge and suspends until it resolves.

function Projects() @{
	const projects = useInvoke<Project[]>('list_projects', { archived: false });
	<ul>
		@for (const project of projects; key project.id) {
			<li>{project.name as string}</li>
		}
	</ul>
}

useInvokeState(channel, args?, options?)

Non-suspending { status, data, error, refetch }. No stale-while-revalidate; use @octanejs/tanstack-query when you need a query cache.

useIpcEvent(channel, handler, options?)

Subscribes for the call-site lifetime. Handlers receive payload args (Electron's event object is stripped in preload). handler / onError are ref-stable; only channel and enabled resubscribe.

useNativeTheme() / useWindowState()

Reactive reads over the default bridge push channels.

Desktop helpers

app, windowControls, dialog, shell, clipboard, and screen are promise helpers over the same bridge (no hooks). Main-only constructors (Menu, Tray, session, protocol, BrowserWindow, …) are available from @octanejs/electron/main/native in the main process — see below.

Off-host behavior

Everything is guarded on the configured bridge global (default window.__OCTANE_ELECTRON__):

| | no Electron bridge | | --- | --- | | useInvoke | rejects with ElectronUnavailableError | | useInvokeState | status: 'error' with ElectronUnavailableError | | useIpcEvent | throws ElectronUnavailableError (or onError) | | theme / window hooks | SSR-safe defaults until a host exists |

Tests install a mock with installElectronBridge from @octanejs/electron.

Not covered in the renderer (intentional)

Menu, Tray, session, protocol, BrowserWindow construction, and related main-only APIs are not bridged into Octane UI code — the same constraint a React Electron app has under contextIsolation. Import them in the main process:

import { Menu, Tray, session, protocol, BrowserWindow } from '@octanejs/electron/main/native';

Or import the same symbols from electron / electron/main. See UPSTREAM.md.