updates for fasten-desktop.

Unfortunately the /wails/runtime.js request is expected to fail in Docker, but will work in desktop env. Working on a better solution.
This commit is contained in:
Jason Kulatunga 2024-06-14 14:43:05 -07:00
parent 1485329b76
commit ea8a996d29
No known key found for this signature in database
3 changed files with 9 additions and 4 deletions

View File

@ -39,6 +39,10 @@
<!-- required for lhncbc/lforms -->
<script src="./assets/js/webcomponents/webcomponents-loader.js"></script>
<!-- wails -- this file is expected to be missing in docker/web mode. It's only required in Desktop -->
<script type="module" src="/wails/runtime.js"></script>
<script>
if (!window.customElements) {
document.write('<!--');

View File

@ -6,7 +6,7 @@ export function OpenExternalLink(url: string, desktopMode: boolean, windowId?: s
//check if wails exists and is defined
if(typeof wails !== "undefined" && desktopMode){
wails.CallByName("pkg.AppService.BrowserOpenURL", url, windowId || 'external')
wails.Call.ByName("github.com/fastenhealth/fasten-desktop/pkg.AppService.BrowserOpenURL", url, windowId || 'external').then(console.log, console.error)
} else{
window.open(url, "_blank");
}

View File

@ -74,9 +74,10 @@ declare global {
Once: (eventName, callback) => void
On: (eventName, callback) => void
}
Call: (options) => Promise<any>
CallByID: (methodID, ...args) => Promise<any>
CallByName: (name, ...args) => Promise<any>
Call: {
ByID: (methodID, ...args) => Promise<any>
ByName: (name, ...args) => Promise<any>
}
}
//see https://lhncbc.github.io/lforms/ for definitions