替换电子版中的“提示” [英] Replace 'Prompt' in on Electron
问题描述
如何在电子中替换javascript 提示
的功能?
How to replace the function of javascript prompt
in electron?
有人可以给我一个例子吗?
Can someone give me an example?
我尝试使用功能提示
,但出现错误:
I tried to use the function prompt
, but got an error:
未捕获的错误:提示()将不受支持。
Uncaught Error: prompt() is and will not be supported.
推荐答案
提示
,确认
和 alert
是阻止脚本执行线程直到用户输入的函数,这就是电子团队没有这样做的原因支持它。相反,出于相同的原因,您可以使用一些第三方程序包。
prompt
, confirm
and alert
are functions which blocks the execution thread of the script until a user input and that's the reason electron team didn't supported it. Instead you can use some third party package for the same reason.
有些程序包以异步方式提供此功能
Here are some packages which provides this functionality in async way
https://www.npmjs.com/package/smalltalk
https://www.npmjs.com/package/ vex-js
https:/ /www.npmjs.com/package/dialogs
这篇关于替换电子版中的“提示”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!