1
The onclick event is not calling the desired function
HTML:
<!DOCTYPE>
<html>
<head>
<script type="text/javascript" src="main.js"></script>
<title>
app
</title>
</head>
<body>
<form id="form">
<input type="button" onclick="CriarLobby()"> criar lobbt </input>
</form>
</body>
</html>
JAVASCRIPT
const { app, BrowserWindow} = require('electron');
const axios = require('axios');
const LCUConnector = require('lcu-connector');
const connector = new LCUConnector();
const https = require('https');
const agent = new https.Agent({
rejectUnauthorized: false,
});
function createWindow(){
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('index.html')
}
app.whenReady().then(createWindow)
connector.on('connect', async(credentials) => {
console.log('League Client started.');
const api = axios.create({
baseURL: `https://127.0.0.1:${credentials.port}`,
headers: {
'content-type': 'application/json',
'Authorization': `Basic ${Buffer.from(`${credentials.username}:${credentials.password}`)
.toString("base64")}`,
},
httpsAgent: agent
});
function CriarLobby(){
api.post('/lol-lobby/v2/lobby', {
queueId: 430,
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
}
}).start();
your code worked but when I replaced it with my original function (msm creating it in the script tag) the function was not called, I tried even using the following code:
<form id="form">
 <button id="botao"> criar lobby </button>
</form>
<script type="text/javascript">
 if(document.getElementById('botao').clicked == true)
{
 CriarLobby();

}

</script>
but it didn’t work, I believe that the problem can only be in function– Math
as to the console the result is this: image
– Math
I already answered hehe :)
– Dakota