Skip to content

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

@luffs

Description

@luffs
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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions