rxjs-diff-operator
v0.1.2
Published
toDiff/fromDiff operators for RxJs 5 - useful for sending observables over network.
Downloads
4
Readme
rxjs-diff-operator
this package adds toDiff/fromDiff operators for RxJs 5. for more deep information about the operator and the protocol, please check observable-diff-operator
Operators:
toDiff
signature: toDiff(): Observable<IObservableDiff>
Description
toDiff operator is used to convert output of an obsersvable stream, into a stream that contains diff information. this operator is inteded to be used on the server.
Example
//emit (1,2,3,4,5)
const source = Rx.Observable.from([1,2,3,4,5]);
//add 10 to each value
const example = source.toDiff();
//output: { type: "init", payload: 1, isObject: false }, { type: "update", payload: 2 }, ...
const subscribe = example.subscribe(val => console.log(val));
fromDiff
signature: fromDiff(): Observable<any>
Description
fromDiff operator is used to convert output of an diff obsersvable stream (see toDiff above), into a stream that contains diff information. this operator is inteded to be used on the client.
Example
//emit diff information
const source = Rx.Observable.from([{ type: "init", payload: 1, isObject: false }, { type: "update", payload: 2 }, { type: "complete" }]);
//add 10 to each value
const example = source.fromDiff();
//output: 1, 2
const subscribe = example.subscribe(val => console.log(val));
Contributions
Contributions, issues and feature requests are very welcome. If you are using this package and fixed a bug for yourself, please consider submitting a PR!