rmosolgo / batman-react-trial Goto Github PK
View Code? Open in Web Editor NEWmessing around with batman.js and react
messing around with batman.js and react
I haven't looked deeply at your implementation but you are saying that you have issues knowing when to update the React component.
A common pattern used by Meteor and Vue.js is to replace every time you read a value by a getter. What you do is run the function, see all the values that have been accessed, do a diff of what has been accessed during the previous round and add/remove the listeners accordingly.
This way, you can have arbitrary javascript code running and still have precise data binding.
This is about code on the better-context
branch.
I use data-showif
to modify a descriptor's props.style.display
:
style = @descriptor.props.style || {}
if shouldShow
delete style.display
else
style.display = 'none !important'
@descriptor.props.style = style
Here's an example from animals/show
:
<p data-showif='animal.animalClass | eq "Mammal"'>
Mammalian
</p>
<p data-showif='animal.animalClass | eq "Reptile"'>
Reptilian
</p>
It works on initial page load, but not on subsequent renders when the data has changed. For example, if I change T-Rex to Mammal
, it should hide "Reptilian"
and show `"Mammalian".
It looks like the transformation is applied. You can see display: none !important
in the React plugin:
But it doesn't seem like the DOM is affected. Both elements are visible:
And in the chrome inspector, neither one has style.display
:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.