effects-runtime
effects-runtime copied to clipboard
refactor: event 系统
目前存在两个个问题,大家看一下 1、老接口是否保留 2、点击/消息元素 是挂在 Player 上还是挂在各自的 合成上,现在为了方便操作,用户直接使用元素的事件emit更简单一些,不需要进行名称的筛选
@yiiqii @wumaolinmaoan @RGCHN @liuxi150 确定后更新 threejs的变动 及 单测
Summary by CodeRabbit
-
New Features
- Introduced event emission for player activities, such as state changes and errors.
- Enabled user interactions within the player component with dedicated event listeners.
- Added new methods for controlling playback state and handling events in the player.
- Improved interactivity within the rendering process through enhanced event bindings.
-
Improvements
- Enhanced event handling across the
Playerand related classes, promoting an event-driven architecture. - Deprecated outdated callback functions to streamline event management.
- Refactored player creation and scene loading for improved modularity and clarity.
- Enhanced event handling across the
-
User Experience
- Improved responsiveness and interactivity in visual effects handling.
- Enhanced navigation structure for better access to interactive content.
- Updated resource loading process for more effective scene management.
Walkthrough
Recent updates significantly enhance event handling across the effects and demo packages by integrating the EventEmitter class. This allows components to emit and respond to key events like webglcontextlost, composition end, and playback controls, leading to improved modularity and responsiveness. The shift towards an event-driven architecture streamlines interactions, making the player more dynamic and cohesive in its user experience.
Changes
| File Path | Change Summary |
|---|---|
packages/effects/src/player.ts |
Improved event emissions in Player; deprecated several callback properties for an event-driven design. |
packages/effects-threejs/src/three-display-object.ts |
Added pause and resume methods for playback control, enhancing interactivity with event dispatching. |
packages/effects-threejs/src/three-composition.ts |
Removed callback properties from CompositionBaseProps; added centralized handling for item messages. |
packages/effects-core/src/composition.ts |
Enhanced Composition class with event emissions; replaced callback with handleItemMessage. |
web-packages/demo/src/dashboard.ts |
Refactored player instantiation and scene loading, enhancing modularity and asynchronous handling. |
web-packages/demo/src/common/three-display-object.ts |
Added new event listeners for improved interaction with player events. |
web-packages/demo/src/three-particle.ts |
Changed data source for json, impacting data retrieval flexibility. |
plugin-packages/spine/demo/src/api-test.ts |
Removed playerOptions object, eliminating associated end playback handling. |
plugin-packages/spine/demo/src/simple.ts |
Removed onItemClicked callback from playerOptions, simplifying interaction feedback. |
web-packages/test/unit/src/effects-core/plugins/common/end-behevior.spec.ts |
Enhanced type safety and clarity in function signatures and variable declarations. |
Poem
In the realm where events now play,
Each click and pause brightens the day.
With players dancing, compositions sing,
A joyful symphony that changes everything.
As rabbits hop in code's embrace,
We celebrate this wondrous space!
🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai generate interesting stats about this repository and render them as a table.@coderabbitai show all the console.log statements in this repository.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (invoked as PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
元素监听事件和合成监听事件应该都支持比较合理?