proposal: reset.by and update.by (the "sub" should be removed)
betula opened this issue · comments
const r = signal();
const u = signal<number>();
const v = value(0);
v.reset.by(r);
v.update.by(u, (state, up_value, up_value_prev) => {
return state + (up_value - (up_value_prev || 0));
});
u(10);
r();
And I think to vary interesting idea is the convert "reset" function method to signal
const a = value(0);
a.reset.to(() => console.log("reset"));
Added to "the stream of conciseness 0.7+ roadmap"