Browse Source

Fix documentation (#91)

* fix links in docs

* fix logo on several md files

* fix typo
master
Andrea D'Intino 3 years ago
committed by GitHub
parent
commit
8c65968437
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      bindings/javascript/README.md
  2. 2
      docs/pages/javascript.md
  3. 6
      docs/pages/zenroom-javascript1.md
  4. 8
      docs/pages/zenroom-javascript2.md
  5. 2
      docs/pages/zenroom-javascript3.md

2
bindings/javascript/README.md

@ -2,7 +2,7 @@
<br>
<p align="center">
<a href="https://dev.zenroom.org/">
<img src="https://raw.githubusercontent.com/DECODEproject/Zenroom/master/docs/logo/zenroom_logotype.png" height="140" alt="Zenroom">
<img src="https://raw.githubusercontent.com/DECODEproject/Zenroom/master/docs/_media/images/zenroom_logo.png" height="140" alt="Zenroom">
</a>
</p>
<br><br>

2
docs/pages/javascript.md

@ -2,7 +2,7 @@
<br>
<p align="center">
<a href="https://dev.zenroom.org/">
<img src="https://raw.githubusercontent.com/DECODEproject/Zenroom/master/docs/logo/zenroom_logotype.png" height="140" alt="Zenroom">
<img src="https://raw.githubusercontent.com/DECODEproject/Zenroom/master/docs/_media/images/zenroom_logo.png" height="140" alt="Zenroom">
</a>
</p>
<br><br>

6
docs/pages/zenroom-javascript1.md

@ -6,7 +6,7 @@
> a tiny and portable virtual machine that integrates in any application to authenticate and restrict access to data and execute human-readable smart contracts.
>
> <cite><a href="https://www.zenroom.org">https://www.zenroom.org</a> The zenroom guru</cite>
> <cite><a href="https://www.zenroom.org">The zenroom guru</a> </cite>
## 📑 Some RTFM and resources
@ -60,7 +60,7 @@ Now we need to run the file we just created by simply run
🎉🎉🎉
You’ll find the asciimation here: [https://asciinema.org/a/274518](https://asciinema.org/a/274518)
You’ll find the asciimation [here](https://asciinema.org/a/274518).
## 🔥 Let’s complicate it a bit! Let’s run Zencode!
@ -105,7 +105,7 @@ Et voila the result is something like (I prettified for the purpose of readabili
```
**NB. The documentation of zencode is available** [**here**](https://dev.zenroom.org/zencode/)
**NB. The documentation of zencode is available** [**here**](/pages/zencode)
In the next article we will see how to run the same examples within a browser.

8
docs/pages/zenroom-javascript2.md

@ -6,7 +6,7 @@ So we saw before that the way we have to interact from Zenroom to JS is via tran
The output of this operation is a binary `.wasm` file and a `.js` file that we will call glue code. In this glue code there are mostly helper functions to interact with the components inside the wasm file, starting with where to retrieve them and so on.
Zenroom itself exposes two main family of functions to interact with other languages `zenroom_exec` and `zencode_exec` as documented here [https://dev.zenroom.org/wiki/how-to-embed/](https://dev.zenroom.org/wiki/how-to-embed/) that are exactly the functions exported and available in our `.wasm` file.
Zenroom itself exposes two main family of functions to interact with other languages `zenroom_exec` and `zencode_exec` as documented in [Zenroom as a lib](/pages/how-to-embed) that are exactly the functions exported and available in our `.wasm` file.
Making the WASM working within the browser, months ago was a hard thing, but nowadays a huge effort has spent, and all the new major browsers support it natively.
@ -43,7 +43,7 @@ $ python3 -m http.server
This will serve your pages by default on the 8000 port so point your browser to [http://localhost:8000](http://localhost:8000)
Back to the code, that simply print the emscripten module that you can now interact with like native calls. Documentation on how to interact is available on [https://emscripten.org/docs/porting/connecting\_cpp\_and\_javascript/Interacting-with-code.html?highlight=cwrap#interacting-with-code-ccall-cwrap](https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html?highlight=cwrap#interacting-with-code-ccall-cwrap)
Back to the code, that simply print the emscripten module that you can now interact with like native calls. Documentation on how to interact is available on [emscripten.org](https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html?highlight=cwrap#interacting-with-code-ccall-cwrap)
You should have seen something like this in your browser inspector:
@ -92,9 +92,9 @@ So `exec_error` and `exec_ok` are callbacks defined in zenroom that are executed
Then obviously `print` is the way we want to see the output, the standard function `console.log` is pretty okay 😉 so we just use that in this case, but sometimes you want to instruct it to print maybe directly on the DOM, that is up to you.
Let’s go now to the next line that is fundamental the `onRuntimeInitialized` [https://emscripten.org/docs/api\_reference/module.html?highlight=onruntime#Module.onRuntimeInitialized](https://emscripten.org/docs/api_reference/module.html?highlight=onruntime#Module.onRuntimeInitialized) is a callback that is executed when everything Wasm-side is okay is something you want always put as a wrapper of your interaction with the wasm module.
Let’s go now to the next line that is fundamental the `onRuntimeInitialized` [(reference here)](https://emscripten.org/docs/api_reference/module.html?highlight=onruntime#Module.onRuntimeInitialized) is a callback that is executed when everything Wasm-side is okay is something you want always put as a wrapper of your interaction with the wasm module.
Now we are able to define our `cwrap` call as mentioned previously from the emscripten documentation, and define our `zencode_exec` as defined in the [Zenroom’s embed](https://dev.zenroom.org/wiki/how-to-embed/) documentation.
Now we are able to define our `cwrap` call as mentioned previously from the emscripten documentation, and define our `zencode_exec` as defined in the [Zenroom as a lib](/pages/how-to-embed) documentation.
Briefly we passed to the `zencode_exec` our contract without any of `conf`, `keys` and `data` and with and muted with `0` `verbosity`

2
docs/pages/zenroom-javascript3.md

@ -7,7 +7,7 @@ We all know, React is one of the most adopted frameworks for client-side nowaday
Anyhow having React working with WASM is not as straightforward as it seems and there are several attempts and several ways to achieve it (try to search on the web: wasm + react)
What we propose here is, in our opinion, the more pragmatic way with less steps freely inspired by [https://medium.com/@marvin\_78330/webassembly-react-and-create-react-app-8b73346c9b65](https://medium.com/@marvin_78330/webassembly-react-and-create-react-app-8b73346c9b65)
What we propose here is, in our opinion, the more pragmatic way with less steps freely inspired by [Marvin Irwin's article](https://medium.com/@marvin_78330/webassembly-react-and-create-react-app-8b73346c9b65).
## 🎮 Let’s get our hands dirty

Loading…
Cancel
Save