1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2024-12-01 13:20:54 +00:00

Call window.runtime methods via Wails JS

This commit is contained in:
Romein van Buren 2023-01-18 13:55:00 +01:00
parent f7c8f9b807
commit 8d9c163d3b
Signed by: romein
GPG Key ID: 0EFF8478ADDF6C49
3 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,7 @@
<script> <script>
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { Hosts, OpenConnection } from '../wailsjs/go/app/App'; import { Hosts, OpenConnection } from '../wailsjs/go/app/App';
import { Environment, WindowSetTitle } from '../wailsjs/runtime';
import BlankState from './components/blankstate.svelte'; import BlankState from './components/blankstate.svelte';
import ContextMenu from './components/contextmenu.svelte'; import ContextMenu from './components/contextmenu.svelte';
import AddressBar from './organisms/addressbar/index.svelte'; import AddressBar from './organisms/addressbar/index.svelte';
@ -32,14 +33,14 @@
}); });
activeHostKey = hostKey; activeHostKey = hostKey;
addressBarModalOpen = false; addressBarModalOpen = false;
window.runtime.WindowSetTitle(`${hosts[activeHostKey].name} - Mongodup`); WindowSetTitle(`${hosts[activeHostKey].name} - Mongodup`);
} }
busy.end(); busy.end();
} }
onMount(() => { onMount(() => {
window.runtime.Environment().then(e => environment = e); Environment().then(e => environment = e);
Hosts().then(h => hosts = h); Hosts().then(h => hosts = h);
}); });
</script> </script>

View File

@ -3,6 +3,7 @@
import { createEventDispatcher } from 'svelte'; import { createEventDispatcher } from 'svelte';
import { DropCollection, DropDatabase, OpenCollection, OpenConnection, OpenDatabase } from '../../../wailsjs/go/app/App'; import { DropCollection, DropDatabase, OpenCollection, OpenConnection, OpenDatabase } from '../../../wailsjs/go/app/App';
import Grid from '../../components/grid.svelte'; import Grid from '../../components/grid.svelte';
import { WindowSetTitle } from '../../../wailsjs/runtime';
export let hosts = {}; export let hosts = {};
export let activeHostKey = ''; export let activeHostKey = '';
@ -32,7 +33,7 @@
}); });
activeHostKey = hostKey; activeHostKey = hostKey;
dispatch('connected', hostKey); dispatch('connected', hostKey);
window.runtime.WindowSetTitle(`${hosts[activeHostKey].name} - Mongodup`); WindowSetTitle(`${hosts[activeHostKey].name} - Mongodup`);
} }
busy.end(); busy.end();

View File

@ -1,6 +1,7 @@
<script> <script>
import { onMount, tick } from 'svelte'; import { onMount, tick } from 'svelte';
import { Hosts } from '../../../wailsjs/go/app/App'; import { Hosts } from '../../../wailsjs/go/app/App';
import { Environment } from '../../../wailsjs/runtime';
import { input } from '../../actions'; import { input } from '../../actions';
import Modal from '../../components/modal.svelte'; import Modal from '../../components/modal.svelte';
import DatabaseList from './dblist.svelte'; import DatabaseList from './dblist.svelte';
@ -42,7 +43,7 @@
} }
onMount(() => { onMount(() => {
window.runtime.Environment().then(e => environment = e); Environment().then(e => environment = e);
Hosts().then(h => hosts = h); Hosts().then(h => hosts = h);
}); });
</script> </script>