You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library feels too heavy, with all the submodules, and some features like serialization that have not seen much use in practice. Proposed new API, inspired by https://observablehq.com :
Before:
var my = ReactiveModel()
("a") // Create the property "a" with no default value.
("b", function (a){
return a + 1;
}, "a");
})
After:
constmodel=reactiveModel({b: [a=>a+1,'a']})
Before:
functionincrement(x){returnx+1;}varmy=ReactiveModel()("a",5)// Create the property "a" with a default value of 5.("b",increment,"a")("c",increment,"b");
// An object will be used when more than one dependency,// because long argument lists was a problem when using the library.// In this project https://github.com/unhcr/dataviz-streamgraph-explorercosntadd=({x, y})=>x+y;constmodel=reactiveModel({c: 5,d: 10,e: [add,'c, d']})
constmodel=reactiveModel({fullName: ({firstName, lastName})=>`${firstName}${lastName}`});// Setting like this will let us propagate the changes synchronously,// when setting multiple fields, not relying on requestAnimationFrame,// which complicated the implementation unnecessarily.model.set({firstName: 'Jane',lastName: 'Smith'});
The text was updated successfully, but these errors were encountered:
This library feels too heavy, with all the submodules, and some features like serialization that have not seen much use in practice. Proposed new API, inspired by https://observablehq.com :
Before:
After:
Before:
After:
Before:
After:
Before:
After:
The text was updated successfully, but these errors were encountered: