Skip to content

Commit

Permalink
js: add sleep to electron app to avoid loading before page
Browse files Browse the repository at this point in the history
  • Loading branch information
paveyry committed Nov 18, 2020
1 parent 6339a61 commit ca180af
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions js/electron_code_wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ app.on('web-contents-created', (e, webContents) => {
}()
)
`;
if (webContents.id > 3) {
if (webContents.id > -1) {
webContents.on('did-finish-load', () => {
webContents.executeJavaScript(`(console.log("running better-hangoutschat..."))`);
webContents.executeJavaScript(code, true);
var millisecondsToWait = 3500;
setTimeout(function() {
webContents.executeJavaScript(`(console.log("running better-hangoutschat..."))`);
webContents.executeJavaScript(code, true);
}, millisecondsToWait);
});
webContents.on('before-input-event', (event, input) => {
if (input.key == "F12") {
Expand Down

0 comments on commit ca180af

Please sign in to comment.