> For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt.

# Communication Between Node.js and Lynx in Lynxtron

If you are familiar with Electron, you can first understand Lynxtron communication needs in two categories:

1. **Bidirectional message communication between the Node main process and UI**: similar to IPC between Electron's main process and a [`BrowserWindow`](https://www.electronjs.org/docs/latest/api/browser-window) renderer.
2. **Using Node.js capabilities directly in UI code**: Electron technically supports [`nodeIntegration`](https://www.electronjs.org/docs/latest/api/browser-window#new-browserwindowoptions) for calling Node.js capabilities directly in Web code, but enabling it directly is generally not recommended. Lynxtron instead enhances [preload scripts](#use-preload-scripts) so they can use Node.js in an isolated context and expose JS objects for Lynx UI to call.

Lynxtron provides corresponding capabilities for both needs:

- Use `NativeModules.bridge` channels together with the main-process `lynxBridge` (`lynxBridge.handle()` for calls that need a reply, `lynxBridge.on()` for one-way messages) and [`LynxWindow.sendGlobalEvent()`](/next/lynxtron/api/@lynx-js/lynxtron/Class.LynxWindow.md#sendglobalevent) for communication between the Node main process and Lynx.
- Use Lynxtron [preload scripts](#use-preload-scripts). In a preload script, call [`contextBridge.exposeInLynxBTS()`](/next/lynxtron/api/@lynx-js/lynxtron/context-bridge/Interface.ContextBridge.md#exposeinlynxbts) to expose Node.js-side JS objects to [`NativeModules.nodejs.exposed`](/next/lynxtron/api/@lynx-js/lynxtron/lynx/Interface.LynxtronNodejs.md#exposed) in Lynx UI.

## Electron Capability Mapping

| Need                                              | Electron                                                                                                                                                                                                                                                                                                                                  | Lynxtron                                                                                                                                                                                                                                                                                                                                                     |
| ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| UI uses Node.js capabilities                      | [preload scripts](https://www.electronjs.org/docs/latest/tutorial/tutorial-preload) / [`contextBridge.exposeInMainWorld()`](https://www.electronjs.org/docs/latest/api/context-bridge#contextbridgeexposeinmainworldapikey-api) / [`nodeIntegration`](https://www.electronjs.org/docs/latest/api/browser-window#new-browserwindowoptions) | [`lynxPreference.preload`](/next/lynxtron/api/@lynx-js/lynxtron/Interface.LynxPreference.md#preload) + [`contextBridge.exposeInLynxBTS()`](/next/lynxtron/api/@lynx-js/lynxtron/context-bridge/Interface.ContextBridge.md#exposeinlynxbts) + [`NativeModules.nodejs.exposed`](/next/lynxtron/api/@lynx-js/lynxtron/lynx/Interface.LynxtronNodejs.md#exposed) |
| Node main process pushes messages to UI           | [`webContents.send()`](https://www.electronjs.org/docs/latest/api/web-contents#contentssendchannel-args)                                                                                                                                                                                                                                  | [`LynxWindow.sendGlobalEvent()`](/next/lynxtron/api/@lynx-js/lynxtron/Class.LynxWindow.md#sendglobalevent)                                                                                                                                                                                                                                                   |
| UI calls Node main process and waits for a result | [`ipcRenderer.invoke()`](https://www.electronjs.org/docs/latest/api/ipc-renderer#ipcrendererinvokechannel-args) + [`ipcMain.handle()`](https://www.electronjs.org/docs/latest/api/ipc-main#ipcmainhandlechannel-listener)                                                                                                                 | `NativeModules.bridge.call()` + `lynxBridge.handle()`                                                                                                                                                                                                                                                                                                        |
| UI sends one-way messages to Node main process    | [`ipcRenderer.send()`](https://www.electronjs.org/docs/latest/api/ipc-renderer#ipcrenderersendchannel-args) + [`ipcMain.on()`](https://www.electronjs.org/docs/latest/api/ipc-main#ipcmainonchannel-listener)                                                                                                                             | `NativeModules.bridge.send()` + `lynxBridge.on()`                                                                                                                                                                                                                                                                                                            |

## Use Preload Scripts

Lynxtron's [preload scripts](#use-preload-scripts) can be understood as an enhancement of [Electron preload scripts](https://www.electronjs.org/docs/latest/tutorial/tutorial-preload) / [`contextBridge`](https://www.electronjs.org/docs/latest/api/context-bridge) model for Lynx BTS: a preload script can use Node.js APIs directly and expose methods or objects for Lynx UI to call.

In Electron, the preload script and the Web page are in isolated JS contexts. The preload script and Web eventually communicate across contexts through [`contextBridge`](https://www.electronjs.org/docs/latest/api/context-bridge) or IPC, with values serialized, proxied, or copied according to Electron's rules; the Web side cannot directly use the original JS objects from the preload script context.

In Lynxtron, Lynx BTS and preload scripts both run in Node.js, but in isolated JS contexts. The preload script context has Node.js capabilities and can expose JS objects through [`contextBridge.exposeInLynxBTS()`](/next/lynxtron/api/@lynx-js/lynxtron/context-bridge/Interface.ContextBridge.md#exposeinlynxbts) for Lynx BTS to access directly.

### Configure Preload Scripts

When creating a window, specify the preload script through [`lynxPreference.preload`](/next/lynxtron/api/@lynx-js/lynxtron/Interface.LynxPreference.md#preload):

```typescript
// main.ts
import { app, LynxWindow } from '@lynx-js/lynxtron';
import path from 'path';

app.whenReady().then(() => {
  const win = new LynxWindow({
    width: 800,
    height: 600,
    lynxPreference: {
      preload: path.join(__dirname, 'preload.js'),
    },
  });

  win.loadFile('main.lynx.bundle');
});
```

### Expose Node.js APIs from a Preload Script

The preload script can use Node.js APIs directly, then expose them to Lynx with [`contextBridge.exposeInLynxBTS()`](/next/lynxtron/api/@lynx-js/lynxtron/context-bridge/Interface.ContextBridge.md#exposeinlynxbts):

```typescript
// preload.ts
import { contextBridge } from '@lynx-js/lynxtron/context-bridge';
import fs from 'fs';
import path from 'path';

type ExposedNodeApi = {
  readTextFileWithTransform: (
    filePath: string,
    transform: (content: string) => string,
  ) => Promise<string>;
  createReader: (baseDir: string) => {
    read: (relativePath: string) => Promise<string>;
  };
};

const nodeApi: ExposedNodeApi = {
  readTextFileWithTransform: async (filePath, transform) => {
    const content = await fs.promises.readFile(filePath, 'utf8');
    return transform(content);
  },

  createReader: (baseDir: string) => {
    return {
      read: (relativePath: string) => {
        return fs.promises.readFile(path.join(baseDir, relativePath), 'utf8');
      },
    };
  },
};

contextBridge.exposeInLynxBTS(nodeApi);
```

### Call Exposed APIs from Lynx

Lynx BTS accesses these APIs through [`NativeModules.nodejs.exposed`](/next/lynxtron/api/@lynx-js/lynxtron/lynx/Interface.LynxtronNodejs.md#exposed):

The exposed JS object can contain functions. Functions can take other functions as parameters, use closures from the preload script context, and return Promises. Lynx UI can call them as regular asynchronous JS APIs.

```tsx
// App.tsx
const api = NativeModules.nodejs.exposed;

const title = await api.readTextFileWithTransform(
  '/Users/example/notes.txt',
  (text) => text.split('\n')[0],
);

const reader = api.createReader('/Users/example');
const todo = await reader.read('todo.txt');
```

### Example: File Explorer

This example demonstrates using Node.js capabilities exposed by a preload script in Lynx UI:

- The preload script exposes APIs such as `readdir` and `homedir` with [`contextBridge.exposeInLynxBTS()`](/next/lynxtron/api/@lynx-js/lynxtron/context-bridge/Interface.ContextBridge.md#exposeinlynxbts).
- Lynx UI calls these APIs through [`NativeModules.nodejs.exposed`](/next/lynxtron/api/@lynx-js/lynxtron/lynx/Interface.LynxtronNodejs.md#exposed) to browse directories and view file content.


**This is an example below: file-explorer**

**Bundle:** `dist/desktop/main.lynx.bundle`

```tsx
import { useState, useEffect } from '@lynx-js/react';
import '@lynxtron-examples/config/tokens.css';
import './App.css';

interface DirEntry {
  name: string;
  isDirectory: boolean;
  isFile: boolean;
  path: string;
}

export function App() {
  const [currentPath, setCurrentPath] = useState('');
  const [entries, setEntries] = useState<DirEntry[]>([]);
  const [selectedFile, setSelectedFile] = useState<string | null>(null);
  const [fileContent, setFileContent] = useState('');
  const [loading, setLoading] = useState(false);
  const [error, setError] = useState<string | null>(null);

  const loadDirectory = async (dirPath: string) => {
    setLoading(true);
    setError(null);
    try {
      const api = NativeModules.nodejs.exposed;
      const dirEntries = await api.readdir(dirPath);
      setEntries(dirEntries.sort((a, b) => {
        if (a.isDirectory && !b.isDirectory) return -1;
        if (!a.isDirectory && b.isDirectory) return 1;
        return a.name.localeCompare(b.name);
      }));
      setCurrentPath(dirPath);
    } catch (err: any) {
      setError(`Error loading directory: ${err.message}`);
    } finally {
      setLoading(false);
    }
  };

  const goHome = () => {
    const api = NativeModules.nodejs.exposed;
    loadDirectory(api.homedir());
  };

  const goUp = () => {
    const api = NativeModules.nodejs.exposed;
    const parent = api.dirname(currentPath);
    if (parent !== currentPath) {
      loadDirectory(parent);
    }
  };

  const openEntry = async (entry: DirEntry) => {
    if (entry.isDirectory) {
      loadDirectory(entry.path);
    } else {
      setLoading(true);
      setError(null);
      try {
        const api = NativeModules.nodejs.exposed;
        const content = await api.readFile(entry.path);
        setSelectedFile(entry.path);
        setFileContent(content);
      } catch (err: any) {
        setError(`Error reading file: ${err.message}`);
      } finally {
        setLoading(false);
      }
    }
  };





  useEffect(() => {
    goHome();
  }, []);

  if (selectedFile) {
    const api = NativeModules.nodejs.exposed;
    return (
      <view className="container">
        <view className="header">
          <text className="title" text-maxline="1">{api.basename(selectedFile)}</text>
          <view className="back-button" bindtap={() => setSelectedFile(null)}>
            <text className="button-text">Back</text>
          </view>
        </view>
        <scroll-view scroll-y className="file-content">
          <text className="content-text">{fileContent}</text>
        </scroll-view>
        {error && <text className="error">{error}</text>}
      </view>
    );
  }

  return (
    <view className="container">
      <view className="header">
        <text className="title">File Explorer</text>
        <view className="nav-buttons">
          <view className="nav-button" bindtap={goHome}>
            <text className="button-text">Home</text>
          </view>
          <view className="nav-button" bindtap={goUp}>
            <text className="button-text">Up</text>
          </view>
        </view>
      </view>
      <view className="path-bar">
        <text className="path-text" text-maxline="1">{currentPath}</text>
      </view>
      <scroll-view scroll-y className="file-list">
        {loading && <text className="loading">reading dir…</text>}
        {entries.map((entry) => (
          <view
            key={entry.path}
            className={`list-item ${entry.isDirectory ? 'directory' : 'file'}`}
            bindtap={() => openEntry(entry)}
          >
            <text className="item-name" text-maxline="1">{entry.name}</text>
            <text className="item-kind">{entry.isDirectory ? 'folder' : 'file'}</text>
          </view>
        ))}
      </scroll-view>
      {error && <text className="error">{error}</text>}
    </view>
  );
}

```



## Bidirectional Message Communication Between Node Main Process and Lynx

Use this option for window control, system services, database access, main-process state management, and similar tasks. Node.js capabilities stay in the main process, while Lynx calls them through messages.

### Push Messages from Node.js to Lynx

The Node main process can send events to Lynx with [`LynxWindow.sendGlobalEvent()`](/next/lynxtron/api/@lynx-js/lynxtron/Class.LynxWindow.md#sendglobalevent):

```typescript
// main.ts
// Reuse a window created inside app.whenReady(), after its UI listener is registered.
win.sendGlobalEvent('systemInfoUpdate', {
  cpuUsage: 32,
  memoryUsage: 68,
});
```

The Lynx side listens with [`GlobalEventEmitter`](/next/guide/interaction/event-handling/event-propagation.md#globaleventemitter):

```tsx
// App.tsx
import { useEffect, useState } from '@lynx-js/react';

export function App() {
  const [systemInfo, setSystemInfo] = useState(null);

  useEffect(() => {
    const emitter = lynx.getJSModule('GlobalEventEmitter');
    const handleUpdate = (data) => {
      setSystemInfo(data);
    };

    emitter.addListener('systemInfoUpdate', handleUpdate);
    return () => {
      emitter.removeListener('systemInfoUpdate', handleUpdate);
    };
  }, []);

  return <view>{/* render systemInfo */}</view>;
}
```

### Call Node.js from Lynx and Wait for a Result

`bridge.call(method, payload, callback)` returns `void`. Receive the result in the third argument, a callback; do not directly `await bridge.call(...)`. To use `await`, wrap the callback in a Promise, as the System Monitor example does.

```tsx
// App.tsx
NativeModules.bridge.call(
  'getSystemInfo',
  { includeCpuDetail: true },
  (info) => {
    setSystemInfo(info);
  },
);
```

The Node main process registers a handler with `lynxBridge.handle()` to process `bridge.call` invocations. The return value (or a resolved Promise) is sent back to Lynx automatically, similar to `ipcMain.handle()` in Electron:

```typescript
// main.ts
import { app, lynxBridge } from '@lynx-js/lynxtron';

app.whenReady().then(() => {
  lynxBridge.handle('getSystemInfo', (event, params) => {
    return getSystemInfo(params);
  });
});
```

For asynchronous work, return a Promise and let the runtime send the reply when it resolves. **Do not call `event.sendReply()` from a handler registered with `handle`**: the runtime already invokes `sendReply` once with the handler's resolved value, so an explicit call would produce a second, out-of-order reply.

```typescript
lynxBridge.handle('getSystemInfo', (event, params) => {
  return new Promise<SystemInfo>((resolve) => {
    fetchAsync(params, resolve);
  });
});
```

### Send One-Way Messages from Lynx to Node.js

Notify Node.js with `bridge.send` (one-way, no return value needed).

```tsx
// App.tsx
NativeModules.bridge.send('refreshIntervalChanged', { interval: 1000 });
```

The Node main process listens for messages on `lynxBridge` (which is a Node.js `EventEmitter`). This mirrors `ipcMain.on()` in Electron:

```typescript
// main.ts
import { app, lynxBridge } from '@lynx-js/lynxtron';

app.whenReady().then(() => {
  lynxBridge.on('refreshIntervalChanged', (params) => {
    console.log('refresh interval:', params.interval);
  });
});
```

### `lynxBridge` API

`lynxBridge` is a main-process singleton imported from `@lynx-js/lynxtron`. It is a Node.js `EventEmitter`, so it exposes the standard `on` / `once` / `off` / `emit` methods in addition to the invoke helpers below. In Electron terms, `lynxBridge` plays the role of `ipcMain`.

| Method                                   | Description                                                                                                                                                                                       |
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `lynxBridge.handle(method, handler)`     | Registers a handler for `NativeModules.bridge.call(method, args, callback)`. The handler's return value (or a resolved Promise) is sent back to Lynx. Registering the same `method` twice throws. |
| `lynxBridge.handleOnce(method, handler)` | Same as `handle`, but the handler is removed after being called once.                                                                                                                             |
| `lynxBridge.removeHandler(method)`       | Removes a handler previously registered with `handle` / `handleOnce`.                                                                                                                             |
| `lynxBridge.on(channel, listener)`       | Inherited from `EventEmitter`. Receives one-way `NativeModules.bridge.send(channel, args)` messages from Lynx. The listener is called with `(args)`.                                              |

The `handler` signature is `(event: LynxBridgeInvokeEvent, args) => unknown | Promise<unknown>`. The runtime automatically calls [`event.sendReply()`](/next/lynxtron/api/@lynx-js/lynxtron/Interface.LynxBridgeInvokeEvent.md) once with the handler's resolved value, so handlers registered through `handle` / `handleOnce` should express the reply as their return value (or a Promise). Manually invoking `event.sendReply()` from such a handler produces a duplicate reply. `sendReply` is intended for low-level callers that subscribe to the internal invoke event directly instead of going through `handle`.

### Example: System Resource Monitor

This example demonstrates bidirectional message communication between the Node main process and Lynx:

- The Node.js side uses the `os` module to get CPU, memory, and other system information, then pushes updates to Lynx with [`LynxWindow.sendGlobalEvent()`](/next/lynxtron/api/@lynx-js/lynxtron/Class.LynxWindow.md#sendglobalevent).
- The Lynx side receives updates through [`GlobalEventEmitter`](/next/guide/interaction/event-handling/event-propagation.md#globaleventemitter), and can also actively request the latest data with `NativeModules.bridge.call()`.
- Notifications that do not need a return value, such as refresh interval changes, can be sent to the Node main process with `NativeModules.bridge.send()`.


**This is an example below: system-monitor**

**Bundle:** `dist/desktop/main.lynx.bundle`

```tsx
import { useState, useEffect, useCallback } from '@lynx-js/react';
import '@lynxtron-examples/config/tokens.css';
import './App.css';

interface SystemInfo {
  cpuUsage: number;
  memoryUsage: number;
  totalMemory: number;
  freeMemory: number;
  platform: string;
  arch: string;
  uptime: number;
}

declare const NativeModules: {
  bridge: {
    call: (method: 'getSystemInfo', data: object, callback: (info: SystemInfo) => void) => void;
    send: (method: string, data?: any) => void;
  };
};

declare const GlobalEventEmitter: {
  addListener: (event: string, callback: (data: any) => void) => void;
  removeListener: (event: string, callback: (data: any) => void) => void;
};

export function App() {
  const [systemInfo, setSystemInfo] = useState<SystemInfo | null>(null);
  const [refreshInterval, setRefreshInterval] = useState(1000);
  const [isLoading, setIsLoading] = useState(true);

  const loadSystemInfo = useCallback(async () => {
    try {
      const info = await new Promise<SystemInfo>((resolve) => {
        NativeModules.bridge.call('getSystemInfo', {}, resolve);
      });
      setSystemInfo(info);
      setIsLoading(false);
    } catch (error) {
      console.error('Error loading system info:', error);
    }
  }, []);

  const handleSetInterval = useCallback((interval: number) => {
    setRefreshInterval(interval);
    NativeModules.bridge.send('setRefreshInterval', { interval });
  }, []);

  const formatUptime = (seconds: number): string => {
    const days = Math.floor(seconds / 86400);
    const hours = Math.floor((seconds % 86400) / 3600);
    const minutes = Math.floor((seconds % 3600) / 60);
    const secs = Math.floor(seconds % 60);
    return `${days}d ${hours}h ${minutes}m ${secs}s`;
  };

  useEffect(() => {
    loadSystemInfo();

    const handleSystemInfoUpdate = (data: SystemInfo) => {
      setSystemInfo(data);
      setIsLoading(false);
    };

    lynx.getJSModule('GlobalEventEmitter').addListener('systemInfoUpdate', handleSystemInfoUpdate);

    return () => {
      lynx.getJSModule('GlobalEventEmitter').removeListener('systemInfoUpdate', handleSystemInfoUpdate);
    };
  }, [loadSystemInfo]);

  if (isLoading) {
    return (
      <view className="container">
        <text className="body-text">Loading system data…</text>
      </view>
    );
  }

  return (
    <view className="container">
      <text className="app-title">System Monitor</text>

      <view className="panel">
        <text className="panel-title">Processor</text>
        <text className="metric-value">{systemInfo?.cpuUsage.toFixed(1)}%</text>
        <view className="progress-track">
          <view
            className="progress-fill"
            style={{ width: `${Math.min(systemInfo?.cpuUsage || 0, 100)}%` }}
          />
        </view>
      </view>

      <view className="panel">
        <text className="panel-title">Memory</text>
        <text className="metric-value">{systemInfo?.memoryUsage.toFixed(1)}%</text>
        <view className="progress-track">
          <view
            className="progress-fill"
            style={{ width: `${Math.min(systemInfo?.memoryUsage || 0, 100)}%` }}
          />
        </view>
        <view className="info-row">
          <text className="info-key">Total</text>
          <text className="info-value">{systemInfo?.totalMemory.toFixed(2)} GB</text>
        </view>
        <view className="info-row">
          <text className="info-key">Free</text>
          <text className="info-value">{systemInfo?.freeMemory.toFixed(2)} GB</text>
        </view>
      </view>

      <view className="panel">
        <text className="panel-title">System</text>
        <view className="info-row">
          <text className="info-key">Platform</text>
          <text className="info-value">{systemInfo?.platform}</text>
        </view>
        <view className="info-row">
          <text className="info-key">Architecture</text>
          <text className="info-value">{systemInfo?.arch}</text>
        </view>
        <view className="info-row">
          <text className="info-key">Uptime</text>
          <text className="info-value">{systemInfo ? formatUptime(systemInfo.uptime) : ''}</text>
        </view>
      </view>

      <view className="panel">
        <text className="panel-title">Refresh interval</text>
        <view className="interval-buttons">
          <view
            className={`interval-button ${refreshInterval === 500 ? 'active' : ''}`}
            bindtap={() => handleSetInterval(500)}
          >
            <text className="interval-button-text">500ms</text>
          </view>
          <view
            className={`interval-button ${refreshInterval === 1000 ? 'active' : ''}`}
            bindtap={() => handleSetInterval(1000)}
          >
            <text className="interval-button-text">1s</text>
          </view>
          <view
            className={`interval-button ${refreshInterval === 2000 ? 'active' : ''}`}
            bindtap={() => handleSetInterval(2000)}
          >
            <text className="interval-button-text">2s</text>
          </view>
          <view
            className={`interval-button ${refreshInterval === 5000 ? 'active' : ''}`}
            bindtap={() => handleSetInterval(5000)}
          >
            <text className="interval-button-text">5s</text>
          </view>
        </view>
      </view>
    </view>
  );
}

```



## Capability Reference

| Capability                                                              | API                                                                                                                                 |
| ----------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| Configure the window-level preload script                               | [`lynxPreference.preload`](/next/lynxtron/api/@lynx-js/lynxtron/Interface.LynxPreference.md#preload)                                |
| Expose Node.js methods or objects from preload scripts to Lynx          | [`contextBridge.exposeInLynxBTS()`](/next/lynxtron/api/@lynx-js/lynxtron/context-bridge/Interface.ContextBridge.md#exposeinlynxbts) |
| Call Node.js methods or objects exposed by preload scripts from Lynx UI | [`NativeModules.nodejs.exposed`](/next/lynxtron/api/@lynx-js/lynxtron/lynx/Interface.LynxtronNodejs.md#exposed)                     |
| Push events from the Node main process to Lynx                          | [`LynxWindow.sendGlobalEvent()`](/next/lynxtron/api/@lynx-js/lynxtron/Class.LynxWindow.md#sendglobalevent)                          |
| Call the Node main process from Lynx and wait for a result              | `NativeModules.bridge.call` → `lynxBridge.handle()`                                                                                 |
| Send one-way messages from Lynx to the Node main process                | `NativeModules.bridge.send` → `lynxBridge.on()`                                                                                     |

## Why Lynxtron Is Designed This Way

Lynxtron uses two channels to cover the two common Electron capabilities because they solve different problems:

- [`NativeModules.nodejs.exposed`](/next/lynxtron/api/@lynx-js/lynxtron/lynx/Interface.LynxtronNodejs.md#exposed): direct access from Lynx BTS to JS objects exposed by preload scripts, corresponding to using Node.js capabilities in UI through [Electron preload scripts](https://www.electronjs.org/docs/latest/tutorial/tutorial-preload) / [`nodeIntegration`](https://www.electronjs.org/docs/latest/api/browser-window#new-browserwindowoptions).
- `NativeModules.bridge` + `lynxBridge`: message communication between Lynx and the Node main process, corresponding to Electron's `ipcRenderer` ↔ `ipcMain` IPC.

The key difference is not which global object the API is mounted on, but that Lynxtron provides a JS-object exposure path for Lynx BTS.

## API and Spec Links

| API / Spec                                                                                                                          | Description                                                                                             |
| ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| [`LynxWindow`](/next/lynxtron/api/@lynx-js/lynxtron/Class.LynxWindow.md)                                                            | Creates windows and loads Lynx bundles                                                                  |
| [`LynxWindowConstructorOptions`](/next/lynxtron/api/@lynx-js/lynxtron/Interface.LynxWindowConstructorOptions.md)                    | Configures window options such as `lynxPreference`                                                      |
| [`contextBridge.exposeInLynxBTS()`](/next/lynxtron/api/@lynx-js/lynxtron/context-bridge/Interface.ContextBridge.md#exposeinlynxbts) | Exposes JS objects from preload scripts to Lynx BTS                                                     |
| [`LynxWindow.sendGlobalEvent()`](/next/lynxtron/api/@lynx-js/lynxtron/Class.LynxWindow.md#sendglobalevent)                          | Pushes global events from the Node main process to Lynx                                                 |
| [`lynxBridge`](/next/lynxtron/api/@lynx-js/lynxtron/Variable.lynxBridge.md)                                                         | Main-process singleton for handling `bridge.call` / `bridge.send` from Lynx                             |
| [`LynxBridge`](/next/lynxtron/api/@lynx-js/lynxtron/Interface.LynxBridge.md)                                                        | Interface of `lynxBridge`; exposes `handle` / `handleOnce` / `removeHandler` and `EventEmitter` API     |
| [`LynxBridgeInvokeEvent`](/next/lynxtron/api/@lynx-js/lynxtron/Interface.LynxBridgeInvokeEvent.md)                                  | Event object passed to `lynxBridge.handle()`; exposes `sendReply()`                                     |
| [`LynxtronNodejs`](/next/lynxtron/api/@lynx-js/lynxtron/lynx/Interface.LynxtronNodejs.md)                                           | Type of [`NativeModules.nodejs`](/next/lynxtron/api/@lynx-js/lynxtron/lynx/Interface.LynxtronNodejs.md) |
| [`GlobalEventEmitter`](/next/guide/interaction/event-handling/event-propagation.md#globaleventemitter)                              | Listens for global events in Lynx BTS                                                                   |
| [`lynx.getJSModule()`](/next/api/lynx-api/lynx/lynx-get-js-module.md)                                                               | Gets modules such as `GlobalEventEmitter`                                                               |
