-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feature: DOM Observer #8
Conversation
WalkthroughThe recent update brings an observer functionality to a demo, enhances an entity library with new methods and refactoring, and integrates DOM observation in the main library. It focuses on improving interactivity with dynamic list manipulation and ensuring efficient detection and response to changes in the document's structure. Changes
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 7
Configuration used: CodeRabbit UI
Files selected for processing (4)
- demo/observer.html (1 hunks)
- lib/entity.js (4 hunks)
- lib/generators/observer.js (1 hunks)
- lib/main.js (5 hunks)
Additional comments: 6
demo/observer.html (1)
- 7-7: Verify the path to
minijs.umd.js
is correct relative to the demo file's location.lib/main.js (1)
- 101-101: Confirm that
_listenToDOMChanges
is called at the appropriate time during initialization for the desired effect.lib/entity.js (4)
- 55-57: Using spread operator on
this.dynamicAttributes
andCUSTOM_ATTRIBUTES
is correct, but ensureCUSTOM_ATTRIBUTES
are properly defined and used within the context.- 207-217:
initChildren
method correctly initializes child elements. Verify that it's called in the appropriate places to ensure all child elements are initialized.- 219-228:
isInsideEachElement
method correctly checks for parent elements with:each
attribute. Confirm that this method is used effectively to prevent unnecessary initializations.- 270-270: The call to
initChildren
inevaluateEach
is appropriate. Ensure that this does not lead to duplicate initializations or performance issues with large DOM structures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- lib/generators/observer.js (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- lib/generators/observer.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (3)
- demo/observer.html (1 hunks)
- lib/entity.js (6 hunks)
- lib/generators/interpreter.js (1 hunks)
Files skipped from review due to trivial changes (1)
- lib/generators/interpreter.js
Files skipped from review as they are similar to previous changes (2)
- demo/observer.html
- lib/entity.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 4
Configuration used: CodeRabbit UI
Files selected for processing (1)
- lib/entity.js (6 hunks)
Additional comments: 1
lib/entity.js (1)
- 270-270: The integration of
initChildren
withinevaluateEach
is a good use of the new method to ensure child elements are initialized. This change is logically sound and improves modularity by reusing theinitChildren
method.
🚀 PR was released in |
3 similar comments
🚀 PR was released in |
🚀 PR was released in |
🚀 PR was released in |
Description
Adds a DOM Observer that detects added and removed DOM nodes and applies / removes MiniJS bindings.
Demo
Demo below uses the Observer Demo HTML
Screen.Recording.2024-02-06.at.12.52.43.PM.mov
Summary by CodeRabbit
observeDOM
to track and respond to DOM changes, with support for older browsers.📦 Published PR as canary version:
1.0.1-canary.8.ad24fea.0
✨ Test out this PR locally via:
npm install tonic-minijs@1.0.1-canary.8.ad24fea.0 # or yarn add tonic-minijs@1.0.1-canary.8.ad24fea.0