> 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.

# sendGlobalEvent

APISummary
通过客户端向前端发送全局事件，前端可以通过 `GlobalEventEmitter` 监听该事件。

## 语法

### Android

```java
public void sendGlobalEvent(String name, JavaOnlyArray params);
```

#### 参数说明

- `name`: 全局事件名。
- `params`: 全局事件携带的参数。

### iOS

```objc
- (void)sendGlobalEvent:(nonnull NSString *)name withParams:(nullable NSArray *)params;
```

#### 参数说明

- `name`: 全局事件名。
- `params`: 全局事件携带的参数。

### Web

```ts
sendGlobalEvent(eventName: string, params: Cloneable[]): void;
```

#### 参数说明

- `eventName`: 全局事件名。
- `params`: 全局事件携带的参数。

### Desktop (C++)

```cpp
void SendGlobalEvent(const std::string& name, const std::string& json);
```

#### 参数说明

- `name`: 全局事件名。
- `json`: 以 JSON 字符串序列化后的事件负载。

## 兼容性

**Compatibility Table**

**Query:** `lynx-native-api.lynx-view.send-global-event`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-native-api/lynx-view/send-global-event.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| send-global-event | Yes (1.0) | No | Yes (1.0) | Yes (3.7) | Yes (3.7) | Yes |

**`send-global-event`**

send global event to js environment

**Specifications:**

