Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] 为什么 Plugin.Object 类型的插件似乎设计为无法传入配置? #1

Open
CyanChanges opened this issue Jan 16, 2025 · 1 comment

Comments

@CyanChanges
Copy link

代码:

if isinstance(plugin, dict):
self._obj.plugin(plugin)
else:
self._obj.plugin(plugin, config)

@CyanChanges
Copy link
Author

CyanChanges commented Jan 16, 2025

此外, 依赖注入作为 Cordis (/koishi) 的重要组成部分, 当前未提供任何公开方法进行操作
如果实现类似 TypeScript 的 Type Augmentation 支持较困难
至少添加 provide(), set(), 和 get() 等方法供手动提供/获取服务用
也可以同时实现 __getattribute__ 等 magic method 方便使用

Cordis (/koishi) 中基础的事件系统类型也不完善
完整实现应该提供 emit(), async parallel(), bail(), async serial()
(且还有开头为 this 的变体

当前还没有 scope 的相关类型, plugin() 及 inject() 应该返回对应的 EffectScope

希望后续完善((((

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant