title: Electron custom `window.prompt()` (custom since prompts are not supported)
body: <p>Everybody who has ever tried to utilise Electron is probably aware that it does not support <code>window.prompt()</code> and <em>will never do</em>, as the project developers have said in the message below.<a href="https://i.stack.imgur.com/VoQ9w.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VoQ9w.png" alt="enter image description here"></a></p>
  
  <p>Since the Electron devs are not even considering providing this feature I thought of attempting it myself.</p>
  
  <p>I did some research. Checking stuff like "Custom window.prompt()", "overriding default prompt() javascript", etc. were not at all helpful. The most relevant article was about jQueryUI's custom modal-input windows.</p>
  
  <p>As none was already available (or, perhaps, I am just a complete Googleklutz [a person who has difficulty selecting the appropriate search terms or interpreting a results page when using an Internet search engine, specifically Google]) I endeavoured to do all by myself.</p>
  
  <p>I created the markup for the modal (a simple <code>div</code> with an <code>input</code> and a submit button).  <code>function prompt(a, b) {...}</code> was showing that box and another function (local) was listening on the submit button for the submission of the prompt, then setting a variable defined in the parent function (<code>prompt()</code>, so then it (the parent) could return that (via <code>return</code>). I have been to timid to figure out that the <code>return</code> of <code>prompt()</code> is called is immediately after the function waws fired, so for <code>const a = prompt("What shall the value of 'a' be?");</code> => <code>a === ""</code> was always true.</p>
  
  <p>I have withal considered utilising <code>async function prompt(...) {...}</code>. The things that kept my status on just "considered" were: a) I have never used async afore; and b) I was quick to guess (coorect me if wrong) that this would <em>pause</em> the entire document, so you wouldn't be able to open the box, enter anything in it, submit it.</p>
  
  <p>The activity described in the paragraph right before the one above were my attempts from a year ago (gave up), alas, I am now facing the same issue once again. Now I feel secure to state this had been bothering me for a year by now.</p>
  
  <p>I wish NOT to open another window (e.g. via <code>window.open()</code>) and have that as a prompt (as the vanilla <code>window.alert()</code> does). Why? If the user gets to the prompt, but opens another window (e.g. Google to search what to type in) then they may open back my app and the prompt will stay minimised, causing confusion why is the entire app freezed (could have forgotten they have a prompt open somewhere). If it really is necessary to have that in a new window, it has to be a frameless one so it could look as part of the DOM of my app.</p>
  
  <p>Any tip, advice, referrence, library, node module, or eventually a piece of code would be extremely appreciated!</p>