0.9.3 • Published 7 years ago

emce-select v0.9.3

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Emce Select

A mixin for Emce to create an observable for part of the model.

Installation

Install from npm:

npm install emce-select --save

or

yarn add emce-select

Selecting

You pick out the part of the model you would like to observe. You will receive updates until that model is removed, then the observable will complete. If the model doesn't exist when selecting you will start receiving updates when the model gets a value.

You select by specifying which property of the model you want to watch. You can select sub-properties down to five levels.

  emce.select('child').subscribe(...); 

Alternatively you can specify a selector to get the part of the model that you want.

  emce.select(selector).subscribe(...);

Selector (m: T) => U | null

The selector is a function that gets a child model. The selector can be used to create computed values of your model.

  function(model: ExampleModel) {
    return {
      a: model.child,
      b: model.otherchild
    }
  } 
0.9.3

7 years ago

0.9.2

7 years ago

0.9.1

7 years ago

0.9.0

7 years ago