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

建议增加设置/获取 组件标识符功能, 为多个组件共用一个监听器提供便利 #288

Open
btx638 opened this issue Apr 10, 2024 · 2 comments

Comments

@btx638
Copy link

btx638 commented Apr 10, 2024

通常一个组件会对应一个独特的 extra 数据结构, 那么多个组件对应多个不同的 extra ,通过标识符在组件 和 extra 之间建立映射关系。

当多个组件共用一个监听器的时候,如果没有组件标识符,那么无法索引到该组件的 extra 数据结构。

建议增加 component.setId( id ) 或者 setName( name ) , component.getId 或者 getName 2个函数。

@ldcsaa
Copy link
Owner

ldcsaa commented May 6, 2024

通常在OnReceive/OnClose 等事件通知方法中获取extra数据才是安全的。其他地方不应该访问extra数据。
而事件通知方法都有sender参数,这个参数就是组件自身。

@FunlyDay
Copy link

FunlyDay commented May 6, 2024 via email

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

3 participants