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

Feature request: Propagate changes of objects in array to parent #14

Open
luffs opened this issue Sep 25, 2017 · 0 comments
Open

Feature request: Propagate changes of objects in array to parent #14

luffs opened this issue Sep 25, 2017 · 0 comments

Comments

@luffs
Copy link

luffs commented Sep 25, 2017

const blogPosts = icaro([
  {id: 1, topic: "First",content:"..."},
  {id: 2, topic: "Second",content:"..."}
]);

blogPosts.listen(function(changes){
 console.log("changes", changes)
});

blogPosts[0].topic= "Hello";
blogPosts[1].topic = "World";

This doesn't trigger the blogPosts listener, and maybe it would be neat if it did?

Example use case:
I want to use icaro with riot.js, and while I can set an individual listener on the blogPosts-elements to update each <blog-post>, I'm not sure how to trigger the update of the <blog-post-list>, which just contains the topics of the blogposts, not the content.

Edit: Made pull request #15 with a simple fix. Has the drawback that it doesn't include the index of the modified element though.

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

No branches or pull requests

2 participants