API / @owear/core SDK

@owear/core SDK

@owear/core is the main-process SDK. It talks to the kernel over a control socket (NDJSON) and mirrors Electron's API where it can. Import it from app/main.ts and any Node module of your app.

import {
  app, BrowserWindow, WebContents, Menu, MenuItem, Tray,
  dialog, session, webRequest, protocol, safeStorage, nativeTheme, theme,
  screen, powerMonitor, powerSaveBlocker, nativeImage, NativeImage,
  invokeNative, listNativeModules, nativeModuleInfo,
  autoUpdater, installer, defineBridge,
  forkWorker, resolveWorkerEntry, platform,
} from '@owear/core'

Pages

Export Reference
app app.md
BrowserWindow browser-window.md
WebContents web-contents.md
Menu, MenuItem menu.md
Tray tray.md
dialog dialog.md
session session.md
webRequest web-request.md
app.protocol / protocolHandlers protocol.md
safeStorage safe-storage.md
theme / nativeTheme theme.md
screen screen.md
powerMonitor, powerSaveBlocker power-monitor.md
nativeImage, NativeImage native-image.md
invokeNative, listNativeModules, nativeModuleInfo native-modules.md
app.handle / app.send (node bridge) node-ipc.md
app.createChannel / ports ports.md
forkWorker workers.md
autoUpdater auto-updater.md
installer installer.md
defineBridge bridge.md
platform os.platform() — a string constant

The control channel

Everything in this SDK ultimately writes NDJSON to the kernel's control socket and reads responses. The lower-level pieces are also exported for advanced use:

  • invokeNative(module, method, ...args) — call any native module from the main process, without a window.
  • channel (internal ControlChannel) — raw call(cmd, params) and event emitter. Reachable as app.__channel.

See the control protocol for the command list.

Edit this page on GitHub ↗