Skip to content

Commit f32ef2c

Browse files
committed
feat: event
1 parent 8db3138 commit f32ef2c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/trem/miscellaneous/event.mdx

+16
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,19 @@ sidebar_position: 6
1313
:::
1414

1515
## 用法
16+
17+
事件發射
18+
19+
```js
20+
const emit = (event, data) => TREM.variable.events.emit(event, data);
21+
emit("test", { data: "test" });
22+
```
23+
24+
事件接收
25+
26+
```js
27+
const event = (event, callback) => TREM.variable.events.on(event, callback);
28+
event("test", (data) => {
29+
console.log(data); // { data: "test" }
30+
});
31+
```

0 commit comments

Comments
 (0)