Elements WebAssembly - how to deploy the output?

Appears to be a dumb question, but how do you deploy/use the output from an Elements/Oxygene/WebAssembly project. Delphi/TMSWebCore produces a .js file which runs when moved to the web server. I cannot get the output from WebAssembly to do anything.


There are 4 files involved in Wasm:

  • Index.html : This one can/should be changed of course, but it’s what uses and loads the Wasm.
  • wasm/RemObjectsElements.js; This is shared by all wasm and contains the layer between Javascript and Wasm.
  • wasm/Module41.js: this one is per project (named after your project); this contains code to interact with the wasm for project.
  • wasm/Module41.wasm: The actual wasm module

Essentially you can rename/move them all, except that if you do, when instantiating the module you need to pass the name of the wasm file with it:

		<title>Module41 Test Page</title>
		<script lang="javascript" src="wasm/RemObjectsElements.js"></script>
		<script lang="javascript" src="wasm/Module41.js"></script>
	<h1>Module41 Test Page</h1>
	<div id="helloWorld"/>
	<script lang="javascript">
		Module41.instantiate("wasm/Module41.wasm").then(function (result) {
			console.log("WebAssembly file Module41.wasm has been loaded.");
			var program = result.Program();

Thanks, logged as bugs://83262 — to document this better

Thanks. I have tried 3 different browsers and 3 different web servers and half a dozen examples of web assemby, including output from Elements and examples from Mozilla, but I have not yet managed to get a single bit to run in a web page. It should not be this difficult. I will perhaps look at webassembly again in a year or two, but for now I will stick with Delphi/TMS.


I’m sorry to hear that. What kind of errors are you getting? I assume the Elements-based project works ok for you when run from the IDE in the debugger, when Elements does the setup?

Do note that WebAssembly will only work on in the browser for pages accessed via http(s), not for local files (Dom;'t ask me why, but thats the browser’s doing). So that might be (part of) the problem…

Let’s work together to get the working for you!


bugs://83262 got closed with status fixed.