Skip to content

Commit

Permalink
feat: event
Browse files Browse the repository at this point in the history
  • Loading branch information
whes1015 committed Nov 30, 2024
1 parent 8db3138 commit f32ef2c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/trem/miscellaneous/event.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,19 @@ sidebar_position: 6
:::

## 用法

事件發射

```js
const emit = (event, data) => TREM.variable.events.emit(event, data);
emit("test", { data: "test" });
```

事件接收

```js
const event = (event, callback) => TREM.variable.events.on(event, callback);
event("test", (data) => {
console.log(data); // { data: "test" }
});
```

0 comments on commit f32ef2c

Please sign in to comment.