Need information on webassembly

Hi Team,

We are aware that team putting lots of efforts for the WebAssembly support in Oxygene.
Could you please share some information about webAssembly plans.

Thanks

1 Like

We’re always improving all our platforms and languages, but we currently don’t have any concrete major changes for WebAssembly planned that we’re ready to announce; with the possible exception of @Theo69’s (third party) Unified GUI framework that is in the works, if you want to count that.

But I’d be more than happy to answer any more concrete questions, as well as add an y suggestions or requests as to what you want to see better supported or extended in WebAssembly with Oxygene!

There are already some big improvement available.

The complete Browser DOM is now strong typed available.
See: RemObjects.Elements.WebAssembly.DOM

2 Likes

Note: as far as I know, the following is still undocumented!
Further, an event system has been implemented.

As it is not in the templates yet, you have to add the following JS code to the html file:
image

In Program.pas, you add the following code to the Program class:
image

When you have your html in your WebAssembly project, you can set this to Html:
image

When you compile the project now, you can see that a code file has been generated from the HTML file - enabling the event system:

Next step is to create your own implementation of the html class; add a new file to the project and name it index.pas, and add the following code to it:
image

Now for the demo:
Add a button to the index.html:
image
The events=“true” attributes enables the event system on this button.

Change index.pas to contain:
image
As you see there is a problem at this moment - I will file a bug report for this in a moment.

Then add a line to instantiate the class in program.pas:

When you run this (after the bug is solved), it will show the alert as soon as you click the button.

This way you can easily implement all needed handlers on the html elements.

When the templates are in order for this, the “manual” above would have been:

Further, an event system has been implemented.

First step is to create your own implementation of the html class; add a new file to the project and name it index.pas, and add the following code to it:
image

Now for the demo:
Add a button to the index.html:
image
The events=“true” attributes enables the event system on this button.

Change index.pas to contain:
image
As you see there is a problem at this moment - I will file a bug report for this in a moment.

Then add a line to instantiate the class in program.pas:

When you run this (after the bug is solved), it will show the alert as soon as you click the button.

This way you can easily implement all needed handlers on the html elements.

I’ll look at documenting this and the DOM part (the latter which is at least mentioned in the docs, i’m sure, if not extensively covered), soon.

Update: Browser & DOM.

1 Like

Hi Team,

Actually we are working on WebAssembly project with RemObjects SDK and we are using javascript client to communicate with server
(Binmessage)(https://************/binmessage).

Mean of this is when data coming it will be in binary format and it will convert to JSON string after that we have to convert that
string into our internal webassembly object(class binary to string to Binary again)
this works good if data is small else it is taking time to that conversions/process.
And we are facing performance issue in case of big data.

So we would like to know how to prevent this double conversion or is there a RemObjects SDK webassembly client available or planed?

Thanks,

You should be able to use the Remoting SDK for JavaScript APIs from WebAssembly, using our interoperability later, although I don’t believe we have tried that ourselves. i will get someone to create a sample for this.

We are investigating native WebAssembly ROSDK support, but specific to announce yet at this stage, sorry. i will keep you posted.

Remoting SDK for JavaScript APIs from WebAssembly, using our interoperability later

This means we can directly access javascript objects from WebAssembly without any conversion?

Yes. see Interop and related topics. I’m also working on some nifty improvements for the strongly-typed access to the DOM, including events:

this should work in this weeks or next week’s build, I expect (probably next)

(screenshot uses C#; I start there because then can translate the templates to all languages more easily ;), but same applies to Oxygene)

1 Like