Hacker News new | past | comments | ask | show | jobs | submit | mbasso's comments login

Yes! h always returns a memory address to a VNode. In C++ this address is reinterpreted in a VNode, that contains others VNode as children. If you decide to manually manage the memory, you can implement some interesting mechanism to diff vnodes and create vdom trees. To do this, I have to develop some APIs that allows you, for example, to replace a children with another and so on. This is certainly on the roadmap!


DOM interactions are a future feature, I'll update asm-dom to pure WASM without JS when they'll be supported!


Thank you for your answer. I just want to add a little thing to the first point.

> Why the single quotes around function names?

In this case I use quotes to prevent name mangling. I have to be sure that the uglify plugin in webpack does not mangle the names of that object because I'll call it from C++ in this way:

window['asmDomHelpers']['domApi']['createComment'](...)

Also, for the same reason, here I'm using this notation instead of this one:

window.asmDomHelpers.domApi.createComment(...)

to let know the closure compiler that I don't want name mangling.

Without quotes these two different compile processes might cause some problems


Just committed a fix for that in license.md


https://github.com/mbasso/asm-dom/commit/1e1659ebc2357bf34be...

Is in the example the usual place to put this?


This is the license of the example project, the license of asm-dom is in the root dir


Shouldn't the license be in every file?


The only reason to put the license in every file is if the "project" is really a loose collection of independent files, or if you stay up at night fearing a madman on the loose randomly downloads and reuses single files from your projects.

MIT specifically calls out that the notice must be included in copies of "substantial portions" of the software which makes no sense if the entirety of the notice is already part of every file.

> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.


In the "How to apply this license" section it is not mentioned https://choosealicense.com/licenses/mit/

If someone has more information or links about that, please let me know


a "fix" eh?


Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: