npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

emce-child-list

v0.9.4

Published

Create lists of Emces for managing arrays in the model

Downloads

4

Readme

Emce Child List

A mixin for Emce to create a list of Emces from an array in your model.

Installation

Install from npm:

npm install emce-child-list --save

or

yarn add emce-child-list

Creating Lists

If your model has an array of models you would like to create Emces for, use createList it will return an observable of ChildLists which will contain an Emce for each model in the array. Each time the array is updated you will get a new list of Emces, the model objects are tracked by the property specified on create. The same Emce will always represent the same model object. You do not have to handle disposing of the Emces yourself, that will be done for you. The Emces in the list will return a new value for the model in the array it represents, just as the Emces created by createChild.

Note: Due to the limitation of not being able to set a type of a keyof in typescript the createList method does not check that the types are correct and you can get a run time error if you have not selected a list. Make sure you have an empty array if there is nothing in the list.

The create list takes an executer for the Emces in the array, an id parameter; used to track the models, and then you select in the same way as in createChild.

  emce.createList(new ChildExecutor, 'id', 'children')
  .subscribe((list: ChildList<ExampleChild, ExampleAction, EmceChildList<ExampleChild, ExampleAction>) => {
    // handle list update
  })

If the model you are watching is removed the list observable will be completed and you will have to create a new one to watch the model again.

Problems

If you are using other middlewares you must cast the response from createList.

ChildList

A child list is a list of Emces. It is returned from the createList method.

The list is iterable, and you can get an item by using the get method with an id. The id is read on the property given when creating the list.

const child: EmceChildList<Example, ExampleAction> = childList.get(id)