Comments (6)
Probably will not happen because soon virtual-dom will contain virtual-hyperscript, vtree, vdom, see Matt-Esch/virtual-dom#118.
Also, the string templates will return VTree, and also h() returns VTree. So you don't need to use virtual-hyperscript, but you do need to use VTree which is a core requirement in virtual-dom. If we try to generalize VTree to be replaceable, then we need to lose the dependency on virtual-dom, which probably won't happen.
Also, why would someone want another implementation of virtual-dom?
from cyclejs.
I'm not talking about VTree, I'm talking about virtual-hyperscript, which is bundled in Cycle because of just that one line.
virtual-hyperscript is small, but anyway it increases the size of the application. Today, even if someone wanna use VTree directly they still get their app with all the virtual-hyperscript code.
Also, I may be wrong (I didn't actually read the source) but it seems that the virtual-dom repository will contain virtual-hyperscript, but it will not be automatically bundled in the app by something like browserify if the app code don't actually require('virtual-dom/virtual-hyperscript')
, because virtual-dom doesn't depend on virtual-hyperscript; so there is no problem.
About other implementations of virtual-dom, I don't know why would someone use that, this was just a secondary question, but I only thought about it because you said, in your article about MVI (in the section "Renderer separated from View.") that one could play with different implementations -- the same principle applies to Cycle.
from cyclejs.
The optimization here is to import vtree/vnode.js directly and create one instead of using h()
This means that browserify cycle | wc -l
is significantly smaller.
This optimization may or may not be worthwhile
mercury
does not make this optimization and just says "I ship with these 12 modules preloaded and I hope to be <50kb"
from cyclejs.
Ok, I see what you are saying @fiatjaf , and yes it makes sense to replace h() with a simple constructor for VNode in that line of code in therenderEvery that you mentioned. Will do.
But now I remember the real reason why virtual-hyperscript is a dependency. We have a shortcut Cycle.h()
which is now the most practical way of making Views. The other alternative is using raw VNode, but it becomes easily unreadable. I don't want to force people to put virtual-hyperscript separately if anyway they will need to have it.
Once there is mustache and other templates in place, maybe also JSX, then we can review this issue again.
from cyclejs.
Also, you are right. I'm seeing that virtual-dom actually exports h
in all cases, so there is no way to actually reduce the amount of code here.
from cyclejs.
@fiatjaf there is a way to reduce the amount of code.
Just require('virtual-dom/diff')
instead of require('virtual-dom').diff
from cyclejs.
Related Issues (20)
- Consider renaming MainDOMSource to DOMSource HOT 1
- how to render a component with "if else" HOT 2
- cycle/run issue with React Native HOT 2
- feat: suppout custom event on dom element HOT 6
- @cycle/time does not supports managed Expo HOT 2
- Ignore this issue :)
- @cycle/time Assert-equals diagram are misleading HOT 2
- @cycle/time Time.diagram() generated streams have the wrong timestamp
- Example build fails HOT 3
- Question: why there is not an hydrate function for isomorphic app like react? HOT 2
- Returned value of makeHTTPDriver() doesn't typecheck when passed two arguments HOT 3
- statecharts, scxml, xstate - similar projects? HOT 1
- [time] Cannot import from most nor rxjs modules
- doc: Learn it in 1h 37min/egghead video course link is broken HOT 1
- @cycle/state package problem 1.6.0 HOT 2
- History Driver replace problem HOT 3
- [run] Drop dependency on quicktask? HOT 5
- Asyncronous architechute HOT 1
- Is cycle.js still active? HOT 2
- Devtool doesn't build and doesn't exist on chrome web store
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cyclejs.