by TekMol · 8y ago · 0 comments
I thought: Great! Let's try it! So how do I use it? How do I hand over a string of Walt and get a string of WebAssemblyText back?
I though there is a javascript file somewhere in the project that has a compile() function that does that.
And then I clicked on the Quick Start Guide and it looks much more complicated. It tells me to install node, npm, webpack, walt-compiler, walt-loader... set up a project with a certain structure, create a landing page...
Help :) That's not what I want. I just want a function that takes a string and returns a string.
Would it be possible to just offer a javascript file to be used directly in the Browser? That exports a function which translates your JS dialect to WasmText?
Is that file somewhere in there maybe?
It's written in JS so you'll need node to run it, and npm is a package manager for node so you should use that to install and call it.
If you just want a hosted site to play with code, it's linked right at the top: https://ballercat.github.io/walt/
It's written in JS so you'll need node to run it
I happily run JS in my browser all day. Why do I need node for this code?The only reason this "needs" NPM is because it's become convention that all javascript projects need NPM and some related toolchain regardless of their complexity.
The next paragraph of the comment you replied to answers that — you don’t, you can use https://ballercat.github.io/walt/ in your browser.
This is what makes Hacker News great!
And yes! I think answering these kind of simple questions is important, so thanks for asking them.
I'm already having fun with it.
It doesn't translate to wasm text format,
but to wasm binary format.
Oh, ok. That is interesting too. But I would have liked to build a tool where I type Walt on the left and see the resulting WASMtext on the right. So this seems to not be a solution for that.It's not the interface that I would like to use. I want to write Walt on the left and instantly see the WasmT on the right.
Also, that tool does not work here. It gives me 'Uncaught ReferenceError: getAST is not defined' as soon as I type something in the code tab.
If you want the walt->wasm function, it’s usually the loader.
And yes, you can invoke the loader standalone.
Perhaps they should give a much simpler example and then later a webpack example.
It’s open source, open a PR may be?
Perhaps you should try unpkg:
<script src="https://unpkg.com/walt-compile"></script>
And if that doesn't work, perhaps you can submit an issue or a PR.You can then play with the `Walt` global.