-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Labels
Description
This example expects the input
s to mirror each other. This behavior works in the beginning. You can pick either input box and change the value and it will mirror in the other. But if you modify the other, it won't change in the other one. And if you go back to the first one, it won't change the other anymore. Yet, when you put the behavior in another element (such as an span
), it reflects that the stream is working correctly.
import { combine, sample, changes, stepper } from "@funkia/hareactive";
import { runComponent, elements, modelView, fgo, go } from "@funkia/turbine";
const { input, span } = elements;
const tempModel = fgo(function*({ val1_, val2_ }) {
const v = yield sample(stepper(0, combine(changes(val1_), changes(val2_))));
return { v };
});
const tempView = ({ v }) =>
go(function*() {
yield span(v);
const { inputValue: val1_ } = yield input({ value: v });
const { inputValue: val2_ } = yield input({ value: v });
return { val1_, val2_ };
});
const temp = modelView(tempModel, tempView);
runComponent("#app", temp());