add ping function
This commit is contained in:
parent
6946a7821b
commit
0255515f77
3 changed files with 12 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
import { app, BrowserWindow } from "electron";
|
||||
import { BrowserWindow, app, ipcMain } from "electron";
|
||||
import path = require("path");
|
||||
/* import ffmpegPath = require("ffmpeg-static"); */
|
||||
|
||||
|
@ -15,6 +15,8 @@ const createWindow = () => {
|
|||
};
|
||||
|
||||
app.whenReady().then(() => {
|
||||
ipcMain.handle("ping", () => "pong");
|
||||
|
||||
createWindow();
|
||||
|
||||
app.on("activate", () => {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { contextBridge } from "electron";
|
||||
import { contextBridge, ipcRenderer } from "electron";
|
||||
|
||||
contextBridge.exposeInMainWorld("versions", {
|
||||
node: () => process.versions.node,
|
||||
chrome: () => process.versions.chrome,
|
||||
electron: () => process.versions.electron,
|
||||
ping: () => ipcRenderer.invoke("ping"),
|
||||
});
|
||||
|
|
|
@ -4,3 +4,10 @@ var versions: any;
|
|||
const information = document.getElementById("info");
|
||||
|
||||
information.innerText = `Cette application utilise Chrome (v${versions.chrome()}), Node.js (v${versions.node()}), et Electron (v${versions.electron()})`;
|
||||
|
||||
const func = async () => {
|
||||
const response = await versions.ping();
|
||||
console.log(response);
|
||||
};
|
||||
|
||||
func();
|
||||
|
|
Loading…
Reference in a new issue