Question
· Jul 22

Does IRIS support JavaScript asynchronous calls (async/await)?

Working on wrapping an IRIS Cache ObjectScript method that runs for a few seconds. Trying to get UI updates to show BEFORE the method runs in an async/await function. But it seems to be running synchronously rather than asynchronously . So my question is does IRIS/ObjectScript CSP pages support futures with JavaScript or does it run all synchronously.

Product version: IRIS 2024.1
$ZV: IRIS for UNIX (Red Hat Enterprise Linux 8 for x86-64) 2024.1.2 (Build 398_0_23819) Wed Nov 20 2024 18:24:21 EST
Discussion (2)2
Log in or sign up to continue

CSP pages in InterSystems IRIS do include mechanisms to interact with JavaScript asynchronously using features like "HyperEventHead()" and "HyperEventCall()". These functionalities allow the execution of server methods triggered by client-side JavaScript, making it possible to update the UI without refreshing the page. However, it appears that the dynamic invocation of server-side code is managed through mechanisms such as cspHttpServerMethod, which relies on specific server support rather than JavaScript's native Promise or async/await functionalities [1].

If you need fully asynchronous JavaScript futures support, it might require an alternative to CSP, such as modern JavaScript frameworks (e.g., Vue.js, React) communicating via REST APIs, as suggested in discussions about the evolving practices for frontend-backend integrations with IRIS [2][3].

Sources:

Javascript support for IRIS is quite limited, and it includes async/await. But you can wrap all IRIS related stuff to promises, and it will work, kind of. There is a lot of work needed to be done on the driver side, to make it powerful in JavaScript.

At the moment, I'm working on TypeORM support for IRIS, the package not published yet, should finish this week. But mostly working, there are some samples provided, all of them working.

Please have a look. I'm looking forward to any feedback, and open to any suggestions about which JS library would need to get IRIS support next