Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / pas2js / 2022-09

WebAssembly support for DOM access

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

Hello,

Thanks to the sponsoring by Tixeo, the FPC & Lazarus team has developed a pretty unique feature for the FPC WebAssembly support.

Webassembly is a bytecode format and embedding specification that allows you to load and run compiled code into the browser in a restricted environment. It is supported by all major browsers.

You can also run webassembly bytecode in command-line tools such as wasmtime or even in an FPC program, using the wasmtime library.

By itself, WebAssembly has no access to its environment. It can only use what the environment provides: file access, DOM acces etc. If the environment defines it, WebAssembly can use it. The webassembly specification only defines a mechanism to import/export routines from/to the environment in which it runs.

The browser has a rich environment, which it does not (yet) expose to the WebAssembly world. Which is a pity, because this limits the usefulness of WebAssembly in the browser considerably.

FPC has now developed a protocol which allows you to use all Browser APIs by the JOB (Javascript Object Bridge) mechanism, in particular the DOM functionality.

This allows you to build a UI (using HTML) for webassembly programs running in the browser: one can imagine running Lazarus in the browser...

More info about this unique feature can be found in the Wiki:

https://wiki.freepascal.org/WebAssembly/DOM

To my knowledge, the only other programming language to offer this kind of general support for browser API access from webassembly is Rust.

Enjoy,

Michael.

Jy V
to Michael Van Canneyt

Good morning Michael,

I have received your article as a PDF,
thank you,
I was aware of your *JOB* since your email of September 4th 2022, I always like to get news on the progress of WebAssembly.

Kind regards, Jerome.

Show quoted text 49 lines
Hello, Thanks to the sponsoring by Tixeo, the FPC & Lazarus team has developed a pretty unique feature for the FPC WebAssembly support. Webassembly is a bytecode format and embedding specification that allows you to load and run compiled code into the browser in a restricted environment. It is supported by all major browsers. You can also run webassembly bytecode in command-line tools such as wasmtime or even in an FPC program, using the wasmtime library. By itself, WebAssembly has no access to its environment. It can only use what the environment provides: file access, DOM acces etc. If the environment defines it, WebAssembly can use it. The webassembly specification only defines a mechanism to import/export routines from/to the environment in which it runs. The browser has a rich environment, which it does not (yet) expose to the WebAssembly world. Which is a pity, because this limits the usefulness of WebAssembly in the browser considerably. FPC has now developed a protocol which allows you to use all Browser APIs by the JOB (Javascript Object Bridge) mechanism, in particular the DOM functionality. This allows you to build a UI (using HTML) for webassembly programs running in the browser: one can imagine running Lazarus in the browser... More info about this unique feature can be found in the Wiki: https://wiki.freepascal.org/WebAssembly/DOM To my knowledge, the only other programming language to offer this kind of general support for browser API access from webassembly is Rust. Enjoy, Michael. _______________________________________________ Pas2js maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20240503/aebb9341/attachment.htm>