Message from JavaScript discussions

June 2017

— So for highlighting objects with the mouse, the view component doing the highlighting has to know a few things like what kind of object it is etc... I previously ran that action through the datastore, but the propagation time to the component was too slow to support someone moving their mouse around.

Message permanent page


So the immediate mode component accepts a parameter of where the mouse is from the event handler, does some conditional based off what object that is in it's own state (not from presentation state) and then highlights or ignores the object based on the result, all without interacting with the datastore but while still using it's state. in "normal" Flux you would pass that parameter all the way through the datastore

— So all an immediate view component is, is a component with a special render function which accepts a single parameter

Message permanent page


// We use `this` here because Traviso sets it as the event target...

  obj.mouseover = function () {

    d_selection.immediateRender("highlightObject", this);


Message permanent page

— Interesting, I haven't used Flux

— The caveat is you can't invoke it directly... the view domain controlling the component must do so, hence the string in that function call

Message permanent page

— So you basically tell the view domain "render this component with your state and this parameter I am giving you"

Message permanent page

— The magic this allows is untouched immutable state, fully being handled for you

— Very fancy

— Along with that both the component and view domain must be marked as "immediate mode" explictly

— It's good to be explicit about breaking Flux rules :P

— And I'm struggling to implement a pivot table at work