Exposing Coherent to WASM

It would be very useful if Coherent functions like calls or triggers could be
called from WASM, to get more integration between the various systems, which
right now requires strange workarounds. As an example, with a stand-alone WASM
module, an application could enable/disable its Toolbar panels
programmatically, solving the problem of cluttering of the toolbar with
buttons that might not always needed and/or use different buttons for
different purposes, only taking one slot on the toolbar.

This is now available with the CommBus API in SU13 beta (indirectly, you will need some JS code).

This doesn’t seem to fix the “chicken and egg” problem affecting Stand-Alone Toolbar panels in .JS, which is the .JS code being immediately killed the moment the Toolbar panel is closed.

So, if the .JS code required to make this work, is not running because the Toolbar panel is closed, it would defeat the purpose of being able to integrate JS with WASM, for example to call Coherent to either open a panel or disable/enable it depending on the context, all things possible by calling Coherent, which of course requires the .JS code to be running in the first place.

That’s why it would be useful to be able to call Coherent directly from WASM without having to rely on .JS code that might not be available, because the panel its running under is still closed. This way, we could open the panel with WASM and then rely on .JS.

I see your point :+1:

I’m curious what are your current workarounds?

Using events with custom parameters or, in the worse case, writing a file what
I need to communicate, since there’s no way to pass string variables, which
makes unnecessary complex and clunky to do something as simple as writing a
Coherent tooltip text, when it would have been so easy if we could just call
Coherent from Simconnect/WASM with the proper parameter passing, instead of
repurposing events and files for that. And it won’t solve the basic problem of
the Javascript code of a Toolbar panel being killed the moment the panel is
closed, which I understand perfectly it’s for performance reasons but the
issue is, to overcome it, we had to hide the Toolbar panel instead of closing
so, not only we get the likely performance hit of the JS code still running,
but we also get side effects like the Toolbar border (even if it’s very tiny)
affecting the mouse pointer when the panel is only hidden. Instead, if we
could just call Coherent directly from Simconnect, we could really close the
panel when we don’t need it, so we save performances, and we could re-open it
again programmatically when it was needed again, while now there’s no way to
programmatically reopen a Toolbar panel after it has been closed from the
toolbar.

I feel your pain… same problem for US Aircraft developers… if at least
L:VARS could support strings… but we bound to just numeric data… R.

+1 on this. Not having comms between WASM and Coherent makes it very difficult
to keep data synchronized.

I wonder if it supports C:Module: string vars

Not sure, but, the difficulty is we need Coherent being able to talk to WASM
in a better way. Right now the only link between them is via L:VARS, you
cannot write string values to L:VARS (supper sad face) R.

The issue is 100% not being able to communicate strings or structured data
between JS and WASM. IMHO there are legacy developers trying to avoid JS to
stick with the C++/SimConnect from FSX. The better approach would be better
developing in HTML/JS where the code has a close interaction with the sim
engine, the UI and the aircraft animations, and C++ code for those backend
‘module’ functions that JS maybe isn’t suitable for. JS and C++ are basically
the same language, but there don’t seem to be many FSX developers that have
caught up with the JS/HTML/CSS transition in industry.

Right, so tell me, does Coherent support functions such as, injecting
simobjects at my desired locations? or allow me to manipulate AI traffic?, I
could go on…, are you aware that JS code refresh time deprecates as you go to
external views causing the code to run slower and slower as you move away from
the user render object? that imposes big issues when writing custom simulation
physics. And what about if I am creating a module that is Global non dependant
from an airplane? now you cannot launch any coherent unless it is via a panel,
which will cease to run any code as soon as the user closes such panel. FSX
has nothing to do with our request, personally I am using WASM to write custom
simulation code that requires to be tightly attached to each Simulation frame,
something Coherent cannot do at all… You would kill the simulator performance
if you attempt to do all the stuff I am doing via WASM, however Coherent has
no support for simConnect and accordingly I cannot use it either for the stuff
I am doing. WASM C++ has nothing to do with FSX, or old modules sir… this
time your judgement is very far from reality. There is a legit need for WASM
for many developing cases, we have created amazing products with WASM that
would have been unable to be achieve ever in P3D, FSX and let alone Coherent.
Each part of the SDK has it place and use, even weather radar maps are
implemented via WASM and as far as I can tell in the SDK documentation, not
yet via Coherent. What we are requesting here is to find a way to communicate
between different parts of code in the SDK, hardly an unreasonable request.
Best, Raul