JSFiddle - React, Tailwind, and code Playground

by Thalita

JavaScript

async function getMousey() {
	const send = await getMousePosition();
  console.log('We reached to the end of the scroll!, Names are ready in a names.txt file, please check the folder in which you have the software installed', send);
  return send;
}

function getMousePosition() {
  return new Promise(resolve => {
  	let done = false;
    document.addEventListener('mousemove', (event) => {
    	if (done) { return };
      
    	let mouse_X = event.offsetX;
			let mouse_Y = event.offsetY;

			if (mouse_X >= 318 && mouse_Y >= 203) {              
      	done = true;
    		resolve({ x : mouse_X, y : mouse_Y });
			}

			else {
      	console.log("X: " + mouse_X + ", Y: " + mouse_Y);
    	}
    });
 });
}

getMousey();