Git Product home page Git Product logo

Comments (12)

p-sam avatar p-sam commented on July 20, 2024 1

Thanks for the details, indeed both of your issues might be related to the fact it doesn't have a parent window, or rather, that it doesn't take account of the parentWindow argument when used in a renderer process context. I never used it outside of the main process, so i'm not sure what exactly is going on. Could you make sure that the prompt fonction pass a coherent parentWindow value to the browserWindow constructor ?

from electron-prompt.

blurymind avatar blurymind commented on July 20, 2024 1

@sperrichon Have you been able to initiate the prompt from a renderer process, attaching it to the parent window via remote.getCurrentWindow() ?
I thought that would solve it, but it doesn't :(

In that case, can you provide the code?

I will look into making a minimal project example

from electron-prompt.

p-sam avatar p-sam commented on July 20, 2024

Could you tell me with more details what you're expecting and what actually happens?

from electron-prompt.

blurymind avatar blurymind commented on July 20, 2024

The expected behavior is when the main app has been closed/terminated, the prompt should also terminate.

It doesnt, perhaps somehow related to not having a parent window?

To replicate:

  1. open prompt
  2. without closing it, close the main app

It doesnt close, and when you try to close it - you get javascript error:
Attempting to call a function in renderer window that has been closed or released...

from electron-prompt.

blurymind avatar blurymind commented on July 20, 2024

Ah I see.

console.log(remote.getCurrentWindow())
does give me a valid window object

but when using
parentWindow :remote.getCurrentWindow()

I get

F:\stuff\elAPP\node_modules\electron-prompt\lib\index.js:38 Uncaught TypeError: Converting circular structure to JSON

and the prompt doesnt even initialize properly

from electron-prompt.

blurymind avatar blurymind commented on July 20, 2024

I also tried passing the main window from main.js as a variable to the renderer on initialization.
I get the same problems, but at least the prompt initializes

from electron-prompt.

blurymind avatar blurymind commented on July 20, 2024

Ok, I passed it like this and I didnt get any errors:

		prompt({
		title: 'Create New Chapter',
		label: 'Please enter the new Chapters Name:',
		value: 'new',
		//// parentWindow : parentMainWindow, <<- wrong way?
		inputAttrs:{type: ''}},
                remote.getCurrentWindow()) //<<- right way?
                .then((newname) => {
			console.log('result', newname); // null if window was closed, or user clicked Cancel
			if (newname.length==0){alert("You didnt enter a name");return};
			createNew(newname);
			}).catch(console.error);

But that doesnt resolve the issue here. The prompt doesnt get terminated when I close the app

from electron-prompt.

p-sam avatar p-sam commented on July 20, 2024

I have not been able to replicate the error, could you provide me a working example of code that can trigger the error when the "window has been released" ?

from electron-prompt.

p-sam avatar p-sam commented on July 20, 2024

I have not been testing anything, tho I intend to try something too later today

from electron-prompt.

p-sam avatar p-sam commented on July 20, 2024

Fixed by PR #16

from electron-prompt.

blurymind avatar blurymind commented on July 20, 2024

Thank you for the fix 👍 :)

I will test this again when I have some time

from electron-prompt.

p-sam avatar p-sam commented on July 20, 2024

no problem, feel free to reopen the issue in case the problem would not totally resolved.

from electron-prompt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.