[00:15] When instantiating your WebAssembly module, we can pass along an object which contains the functions to be passed to the module inside the end property. We leverage this to provide our function to the WebAssembly module.
[00:30] Then we switch over to our Rust code. There, we also have to declare which function we want to use. In our case, that's appendNumberToBody. The parameter of the function should be an unsigned integer.
[00:45] Now we need to use appendNumberToBody. Therefore, we export the function run. Inside run, we invoke appendNumberToBody. Note that we have to wrap it with an unsafe block, since the Rust compiler can't provide memory safety guarantees for external functions.
[01:32] Let's add one more. In this case, we'll pass the native function [inaudible] to our module. We import the function, invoke it inside of our unsafe block. Then we recompile and reload the page in our browser. Great. This even works with native browser functions, since we can see the [inaudible] dialogue.
I´m sorry, but I think I´ll have to ask for a refund... To this point I barely learned anything on egghead.io as a newbie. Not that I´ve never been doing web-development, but in allmost every video the teachers just rush over almost everything and basically read their code instead of trying to give a proper explanation on what it actually does. Really sad... :/