2023-03-04 08:10:30 -05:00
|
|
|
import React from 'react'
|
2023-03-04 06:19:24 -05:00
|
|
|
import { WebviewWindow } from '@tauri-apps/api/window'
|
2023-03-03 09:29:46 -05:00
|
|
|
import { Loading } from 'components/Loading'
|
2023-03-04 08:10:30 -05:00
|
|
|
import { IPC, Command } from 'ipc';
|
|
|
|
|
|
|
|
|
|
const ipc = new IPC<Command>();
|
2023-03-03 09:06:14 -05:00
|
|
|
|
|
|
|
|
export const Home: React.FC = ({ }) => {
|
2023-03-04 06:19:24 -05:00
|
|
|
const onClick = () => {
|
|
|
|
|
const webview = new WebviewWindow('theUniqueLabel', {
|
|
|
|
|
url: 'https://accounts.nintendo.com/',
|
|
|
|
|
resizable: false,
|
|
|
|
|
focus: true,
|
|
|
|
|
})
|
|
|
|
|
};
|
2023-03-04 08:10:30 -05:00
|
|
|
const onHello = async () => {
|
|
|
|
|
await ipc.send({ type: 'hello', data: '1234' });
|
|
|
|
|
const data = await ipc.recvType('hello');
|
|
|
|
|
console.log(`hello`, data)
|
|
|
|
|
}
|
2023-03-03 09:06:14 -05:00
|
|
|
return <>
|
2023-03-03 09:29:46 -05:00
|
|
|
Hello world! <Loading />
|
2023-03-04 06:19:24 -05:00
|
|
|
<button onClick={onClick}>Open the window!</button>
|
2023-03-04 08:10:30 -05:00
|
|
|
<button onClick={onHello}>Hello</button>
|
2023-03-03 09:06:14 -05:00
|
|
|
</>
|
2023-03-04 06:19:24 -05:00
|
|
|
}
|