tong/hxelectron
소개
Haxe type definitions for electron
개발 도구측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalHXElectron
Haxe type definitions (externs) for Electron, a framework for building cross-platform desktop applications with JavaScript, HTML and CSS.
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).@:deprecatedfor APIs Electron has deprecated.@:electron_experimentalfor 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
관련 프로젝트 살펴보기
불러오는 중…