Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> so does that mean accessing the DOM from python is not possible yet?

No. It means you only get what the person who ported CPython or py2wasm gave you. It's not a limitation in WebAssembly, and maybe they have some other (hopefully better) API than the `easy(123)` example I was trying to show.

> for the second question the example you gave is equivalent to what in plain html/js?

If I understand what you're asking, it's just:

    <!doctype html><title>plain jane</title>
    <script type="module">

    function easy(arg) { 
        const div = document.createElement("div"); 
        div.textContent = "DOM this: " + String(arg); 
        document.body.appendChild(div); 
    }

    easy(123);
    easy(456);

    </script>


It means you only get what the person who ported CPython or py2wasm gave you

that's what i meant. it's not possible until someone adds the necessary features to the wasm port of the language. makes sense of course, like any feature of a new architecture.

If I understand what you're asking

exactly that, thank you. it is easier to understand the example if there is no doubt as to what is the js part and what is wasm (it also didn't help that the code was not easy to read on a phone)




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

Search: