Skip to content

Igorbek/knockout.rx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

knockout.rx 1.0

Reactive Extensions bindings for the KnockoutJS

Download

NuGet

Package: knockout.rx

PM> Install-Package knockout.rx

Or you can download it from Releases of the project.

Usage

For typeScript users typing definition could be found here.

Knockout to Rx

var rxObservable = koSubscribable.toObservable(event?: string);
  • rxObservable return - resulting Rx observable object
  • koSubscribable - source Knockout subscribable object (observable, computed)
  • event optional - event of subscribable to observe; if not specified, used default event for this subscribable (usually 'change' event).
var rxObservable = koObservableOrComputed.toObservableWithReplyLatest();
  • rxObservable return - resulting Rx observable object
  • koObservableOrComputed - source Knockout observable or computed object

Note: toObservableWithReplyLatest returns Rx observable that will notify every observer with latest (current) Ko observable (or computed) value once it subscribed.

Rx to Knockout observale

var koObservable = rxObservable.toKoObservable(initialValue?: any);
  • koObservable return - resulting Knockout observable object
  • rxObservable - source Rx observable object
  • intialValue optional - initial value to keep in resulting Knockout observable before first notification from source Rx observable

Rx to Knockout subscribable

var koSubscribable = rxObservable.toKoSubscribable();
  • koSubscribable return - resulting Knockout subscribable object
  • rxObservable - source Rx observable object

Note: The knockout subscribable does not store last value as Knockout observable do, it used only for change notifications. Exactly like Rx observable.