Observable handling.
- Source:
Methods
-
<static> newResolver(observable, remote, serialize, deserialize)
-
Creates a new resolver.
Each summary creates a new subscription to the observable and drains it until it reports being completed.
Parameters:
Name Type Description observable
external:Observable the observable to read local items from. remote
Summarizer summarizer producing summaires of the remote side. serialize
Serial~Serialize the item serializer. deserialize
Serial~Deserialize the item deserializer. - Source:
Example
var local = Rx.Observable.create(function (observer) { for (var i = 0; i < localStorage.length; i++) { observer.onNext(JSON.parse(localStorage.getItem(localStorage.key(i)))); } observer.onCompleted(); } function serialize(item) { // ... } function deserialize(buffer) { // ... } var resolver = require('mathsync/observable').newResolver(local, remote, serialize, deserialize);
-
<static> newSummarizer(observable, serialize, digester, selector)
-
Creates a new summarizer.
Each summary creates a new subscription to the observable and drains it until it reports being completed.
Parameters:
Name Type Argument Description observable
external:Observable the observable to read local items from. serialize
Serial~Serialize the item serializer. digester
Digest~Digester <optional>
the digester to use, defaults to SHA-1. selector
BucketSelector~Selector <optional>
how to place items in IBF buckets, uses 3 buckets by default. - Source:
Example
var local = Rx.Observable.create(function (observer) { for (var i = 0; i < localStorage.length; i++) { observer.onNext(JSON.parse(localStorage.getItem(localStorage.key(i)))); } observer.onCompleted(); } function serialize(item) { // ... } var summarizer = require('mathsync/observable').newSummarizer(local, serialize);