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

# lynx: registerModule() static method

APISummary
获取一个可以在当前 LynxView 中共享使用的 JavaScript 对象。

## 语法

```ts
registerModule: <Module>(name: string, module: Module) => void;
```

### 参数

#### name

需要注册的对象名。

#### module

需要注册的对象。

### 返回值

无（`undefined`）。

## 示例

### 在 JS 中获取共享对象

Use the [`lynx.getJSModule`] method to get a registered module:

```js
const fooModule = {};
lynx.registerModule('foo', fooModule);
lynx.getJSModule('foo') === fooModule; // true
```

[`lynx.getJSModule`]: /next/zh/api/lynx-api/lynx/lynx-get-js-module.md

## 兼容性


**Compatibility Table**
**Query:** `lynx-api.lynx.registerModule`

**Platform Support**

| Platform | Version Added | Notes |
|----------|---------------|-------|
| Android | 2.4 | - |
| iOS | 2.4 | - |
| HarmonyOS | 3.4 | - |
| Clay macOS | 3.5 | - |
| Clay Windows | 3.5 | - |
| Web | ✅ Yes | - |

