diff --git a/TODO b/TODO index 690315b..4889071 100644 --- a/TODO +++ b/TODO @@ -59,7 +59,8 @@ DONE Bug: slowly dragging should change marble time DONE Cycle.js rewrite DONE Fix throttleWithSelector -TODO Add withLatestFrom example +DONE Add withLatestFrom example +TODO Review all RxJS operators to remove deprecated >>> v1.2.0 TODO Build scripts to replace gulp (?) diff --git a/dist/js/app.js b/dist/js/app.js index 78b69c8..8ff1676 100644 --- a/dist/js/app.js +++ b/dist/js/app.js @@ -24279,6 +24279,16 @@ module.exports = { } }, + withLatestFrom: { + label: "withLatestFrom((x, y) => \"\" + x + y)", + inputs: [[{ t: 0, d: 1 }, { t: 20, d: 2 }, { t: 65, d: 3 }, { t: 75, d: 4 }, { t: 92, d: 5 }], [{ t: 10, d: "A" }, { t: 25, d: "B" }, { t: 50, d: "C" }, { t: 57, d: "D" }]], + apply: function (inputs) { + return inputs[0].withLatestFrom(inputs[1], function (x, y) { + return "" + x.get("content") + y.get("content"); + }); + } + }, + zip: { label: "zip", inputs: [[{ t: 0, d: 1 }, { t: 20, d: 2 }, { t: 65, d: 3 }, { t: 75, d: 4 }, { t: 92, d: 5 }], [{ t: 10, d: "A" }, { t: 25, d: "B" }, { t: 50, d: "C" }, { t: 57, d: "D" }]], diff --git a/src/data/combine-examples.js b/src/data/combine-examples.js index de74a60..77d3a58 100644 --- a/src/data/combine-examples.js +++ b/src/data/combine-examples.js @@ -57,6 +57,19 @@ module.exports = { } }, + "withLatestFrom": { + "label": "withLatestFrom((x, y) => \"\" + x + y)", + "inputs": [ + [{t:0, d:1}, {t:20, d:2}, {t:65, d:3}, {t:75, d:4}, {t:92, d:5}], + [{t:10, d:"A"}, {t:25, d:"B"}, {t:50, d:"C"}, {t:57, d:"D"}] + ], + "apply": function(inputs) { + return inputs[0].withLatestFrom(inputs[1], + (x, y) => ("" + x.get('content') + y.get('content')) + ); + } + }, + "zip": { "label": "zip", "inputs": [