I'm new to Electron
(just like to English :).
I'm trying to output a simple alert
after loading and rendering the contents of the main window.
index.html:
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
<title>Test</title>
</head>
<body>
...
Here's some content and images. A lot of them.
...
<script src="alert.js"></script>
</body>
</html>
alert.js:
//Simple alert with some system information
alert("!@#$%^&*");
But an alert appears before the contents of the window are drawn. Defer
and async
don't help (i.e. <script defer async src="alert.js"></script>
). What am I doing wrong? It seems to me that this is a very simple and stupid question, but I can not find an answer.
UPD:
The only way I found for now is to use setTimeout
:
setTimeout(function(){
alert("!@#$%^&*");
}, 300);