Is An Indoor Location Tracking System Similar To Indoor GPS?

Most large facilities such as warehouses, convention centers, medical facilities, zoo parks, and museums among others seek one holistic technological platform for helping them with indoor wayfinding…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




ipcRenderer communicate with ipcMain by Typescript in Electron

In Electron applications, you can use the ipcRenderer and ipcMain modules for inter-process communication. The official documentation provides a version in JavaScript. Below are the steps to implement it in TypeScript, along with the problems encountered during the process.

Use ipcMain in the main process to set up IPC listeners:

By default, the front-end does not directly access the Electron module or use ipcRenderer. Instead, it does so through preload.ts.

In the rendering process, use the functions by window.electronAPI.

final directory structure of the files:

2. Import the front-end entry page and the preload.ts in main.ts.

3. preload.ts serves as a bridge to expose ipcRenderer to the frontend.

4. Import renderer.ts in index.html. Pay attention to the path: dist

5. the start scripts in package.json, also need to pay attention to the path: dist

If you find my article helpful, please feel free to give a tip. Your support will encourage me to keep creating!

Add a comment

Related posts:

Jual Pohon Ketapang Kencana Terdekat 081249470015 Kota Tangerang Selatan

Jual Pohon Ketapang Ketapang Kota Tangerang Selatan, Selain Peneduh Juga Mempunyai Manfaat Lain Khususnya Khasiat Zat Kimia Yang Ada Didalamnya Jual Pohon Ketapang Ketapang Kota Tangerang Selatan —…

Private NPM Package deployment using VSTS

In my previous article, I explained how you can automate the deployment of your internal Nuget packages using VSTS and how to consume them. Today, I’m going to show you how you can use a very similar…

The Wretched Review

There is an obvious joy in being scared within the context of storytelling. As a species, we seek out movies, hoping to get a taste of artificial adventure. In the case of the horror genre, we get to…