docs: register input handlers

This commit is contained in:
karishmas6
2024-06-08 23:06:22 +05:30
parent 7d10e924ae
commit 9df4a77e25

View File

@@ -345,6 +345,29 @@ const handleGoForward = async (generator: WorkflowGenerator, page: Page) => {
logger.log('debug', 'Page went forward');
};
/**
* Helper function for registering the handlers onto established websocket connection.
* Registers:
* - mousedownHandler
* - wheelHandler
* - mousemoveHandler
* - keydownHandler
* - keyupHandler
* - changeUrlHandler
* - refreshHandler
* - goBackHandler
* - goForwardHandler
* - onGenerateAction
* input handlers.
*
* All these handlers first generates the workflow pair data
* and then calls the corresponding playwright's function to emulate the input.
* They also ignore any user input while interpretation is in progress.
*
* @param socket websocket with established connection
* @returns void
* @category BrowserManagement
*/
const registerInputHandlers = (socket: Socket) => {
socket.on("input:mousedown", onMousedown);
socket.on("input:wheel", onWheel);