I have a little problem, i can't figure out how to track mouse position and update a function every time it moves, this is the code that i want to modify so it updates;
function makeid() {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var i = 0; i < 8; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
console.log(makeid());
Hopefully one of the smart people out there could help me!
@BadPiggie I mean that so every time my code tracks mouse movement the password regenerates.
As you mentioned in the comment, If you want to trigger the makeid evener the mouse move, You can listen to mousemove event on window
function makeid() {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var i = 0; i < 8; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
function mouseMoveEventHandler() {
console.log(makeid());
}
window.addEventListener('mousemove', mouseMoveEventHandler);