Closed yt-dlx closed 1 month ago
@yt-dlx Hi, in this template, you can see how we send data from the frontend, to the js backend via IPC.
In that example:
window.ipc.send('run-sh', value)
via this ipc.sendipcMain.on('run-sh', async (event, value) => {
console.log('DEBUG: starting process') // for dev mode
event.sender.send('log', 'Running...') // for prod mode
await startProcess(event, value)
})
I hope it helps :)
what am i doing wrong? I cloned the example folder and ran 'yarn dev'
@yt-dlx doo you have preload.js
file inside the main folder?
that might be the cause, it is define and exposed in that file.
And when creating a windows, you should pass it like this:
mainWindow = createWindow('main', {
width: 1000,
height: 700,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
}
})
@bm777 in this version there was no preload.js 'https://github.com/saltyshiomix/nextron/tree/main/examples/basic-lang-javascript-python'
can i use the preload.js from the repo?
It should appear if you do:
npx create-nextron-app my-app --example basic-lang-javascript-python
If not, you can copy this preload.js and past it in your main/
I have tried with the preload.js but I am facing the same error. Kindly please help me: https://github.com/yt-dlx/yt-dlx/tree/main/package
Instead of cloning to start your working directory, did you create a whole new project from npx create-nextron-app my-app --example basic-lang-javascript-python
? This will help greatly if you don't start from a clone.
@Psycokwet I tried with the yarn create but same error of window.ipc. I have also tried the preload.js.
@yt-dlx Oh I got the issue:
There is a helper
folder missing. @Psycokwet is right, you didn't create the project with that template. if you did it, it would have automatically also created that folder. it seems, you are trying to integrate it into your project.
The missing folder is this -> https://github.com/saltyshiomix/nextron/tree/651967d7df3d0f7cb306f7d4296866f994fbeb5d/examples/_template/js/main
@bm777 @Psycokwet
I've implemented the changes using 'yarn create' as suggested, but the issue persists. Would you mind reviewing the details?
You can find the commit with the updates here: https://github.com/yt-dlx/yt-dlx/tree/main/package
If you really did start your project with npx create-nextron-app my-app --example basic-lang-javascript-python
You should have this file structure
But in your github example, I see that :
Those are differents, what did you do ? You still miss at least scripts, but I would start anew instead of trying to fix an install made by hand
Note that a fresh project from
npx create-nextron-app my-app --example basic-lang-javascript-python
cd my-app
npm install && npm run dev
This exact set of command launch the app on my mac
@Psycokwet @bm777
Yet the same issues. window.ipc
Thnks guys. I have fixed the issue using electron-vite
Dear Devs,
I hope this message finds you well. I'm currently working with nextron based on Next.js 13.5.6 and I'm facing some challenges incorporating IPC (Inter-Process Communication) into my project. Despite my efforts, I haven't been able to locate any IPC-based examples in your documentation or resources.
Could you please provide some guidance or examples on how to effectively implement IPC within a nextron project? Any assistance you could offer would be greatly appreciated.
Thank you for your time and support.