Skip to content
Projects

tong/hxelectron has 105 GitHub stars and 14 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-17 02:49 UTC. Last push 2026-11-10.

How these counts are measured

Measured star growth

in 24h
0
in 7 days
0
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

About

Haxe type definitions for electron

Web & Apps

README.md

Original

HXElectron

Haxe type definitions (externs) for Electron, a framework for building cross-platform desktop applications with JavaScript, HTML and CSS.

test Haxelib Version

The library version follows the Electron version it was generated from.

Install

Release version:

haxelib install electron

Development version:

haxelib git electron https://github.com/tong/hxelectron.git

Requires Haxe 4.3.7 or newer and hxnodejs, which is installed automatically as a dependency.

Usage

Add the library to your build file and compile to JavaScript. Main and renderer process code are separate targets:

-lib electron
-main Main
-js main.js

Types are split by process: electron.main.* for the main process, electron.renderer.* for renderer processes. Types available in both live directly in electron.*.

import electron.main.App;
import electron.main.BrowserWindow;

class Main {
 static function main() {
  App.on('ready', () -> {
   var win = new BrowserWindow({width: 800, height: 600});
   win.loadFile('app.html');
  });
 }
}

See the demo for a complete application.

Demo application

git clone https://github.com/tong/hxelectron
cd hxelectron/
haxelib dev electron .
cd demo/
npm install       # Install electron
npm run build     # Build main.js and app.js
npm start         # Run the application

String enums

Parameters and properties which only accept specific strings use enum abstract types which are defined in the same module as the type they are used in, e.g. electron.main.App.AppGetPathName. They convert from String, so plain string literals (app.getPath("home")) keep working, and you get completion and typo checks through the enum values (AppGetPathName.home).

Metadata

The externs are annotated with the following metadata:

  • @:electron_platforms(["macOS"|"Windows"|"Linux"|"MAS"]) the supported platforms (only if platform specific).
  • @:deprecated for APIs Electron has deprecated.
  • @:electron_experimental for experimental APIs.

Updating to a new Electron version

All type definitions are generated from electron-api.json by ElectronAPI.hx.

To update to the latest release (requires the GitHub CLI and jq):

./update.sh          # latest release
./update.sh v44.5.1  # specific release

This downloads electron-api.json, regenerates src/, rebuilds haxedoc.xml and bumps the version in haxelib.json and demo/package.json.

To regenerate manually from a description file downloaded from the Electron releases:

haxe api.hxml        # regenerate src/ from electron-api.json
haxe haxedoc.hxml    # build haxedoc.xml to verify everything compiles

License

MIT