fix: improve doc link navigation and tree display
- Fix link resolution with proper relative/absolute path handling - Improve link styling with underline decoration - Hide leaf nodes from tree, only show directories - Fix log file path for packaged app
This commit is contained in:
43
docs/api/core/event/Unsubscribe.md
Normal file
43
docs/api/core/event/Unsubscribe.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# Event::Unsubscribe
|
||||
|
||||
```cpp
|
||||
void Unsubscribe(uint64_t id);
|
||||
```
|
||||
|
||||
退订事件。
|
||||
|
||||
**描述**
|
||||
|
||||
将指定 ID 的回调从订阅列表中移除。退订是延迟生效的,在调用 `Invoke` 时会一并处理待退订的回调。线程安全,可在任意线程调用。
|
||||
|
||||
**参数:**
|
||||
- `id` - 订阅时返回的 ID
|
||||
|
||||
**复杂度:** O(n) 在 Invoke 时处理
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Core/Event.h>
|
||||
|
||||
using namespace XCEngine::Core;
|
||||
|
||||
Event<int> someEvent;
|
||||
|
||||
// 订阅
|
||||
uint64_t id = someEvent.Subscribe([](int value) {
|
||||
printf("Value: %d\n", value);
|
||||
});
|
||||
|
||||
// 退订
|
||||
someEvent.Unsubscribe(id);
|
||||
|
||||
// 触发(已退订的回调不会被调用)
|
||||
someEvent.Invoke(42);
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Event 总览](event.md) - 返回类总览
|
||||
- [Subscribe](Subscribe.md) - 订阅事件
|
||||
- [ProcessUnsubscribes](ProcessUnsubscribes.md) - 手动处理退订
|
||||
Reference in New Issue
Block a user