For my current client we are developing a cross-platform application in Ionic Android. This allows us to write the source code once and package it for Android, iOS or desktop via Electron.
One of the requested features is to support displaying an esri map while the user is offline. Unfortunately, esri's ArcGIS SDK for JavaScript does not support offline maps. They have tried developing this feature in the past but found that the browser ecosystem was too unreliable to support it.
For the mobile builds, I can develop a custom Capacitor plugin (Ionic runs on Capacitor) that leverages either the Kotlin or Swift ArcGIS SDK variants. However, I haven't found a working solution yet for the Electron build. As Electron is also JavaScript, I would be stuck using the ArcGIS JavaScript SDK again.
The client is knowledgeable and experienced with .NET, so my initial thought was to call a DLL from Electron, unfortunately this seems to be quite tricky.
I looked into dotnet interop, but this assumes you would run only on WASM (WebAssembly), which in our case is not feasible.
I then had a look at edge-js, but I cannot seem to target a DLL that has external dependencies (the ArcGIS .NET SDK) of its own.
When I use the EDGE_APP_ROOT
environment variable to point to the folder containing the DLL and the deps.json
file I get the following error:
node:internal/modules/cjs/loader:1189 return process.dlopen(module, path.toNamespacedPath(filename)); ^ Error: Call to coreclr_create_delegate() for GetFunc failed with a return code of 0x80070002.
I looked around to find the cause of this error, but to no avail.
So, at this point I'm a bit at a loss. My question therefore is twofold:
- Is there an easier way to achieve calling .NET code from JavaScript?
- If not, is there anyone with experience in EdgeJS to tell me what I'm doing wrong?
Many thanks for any help or advice offered.