UNPKG

@area2-ai/a2-node-keystroke-package

Version:

## Description

65 lines (64 loc) 2.14 kB
import type { IMobileKeystrokeCollection } from "../interfaces"; /** * Manages keystroke data for a typing session on iOS devices. */ export declare class IosKeystrokeManager { private isTypingSessionActive; private typingData; private openKeyEntry; private textWasPasted; private previousText?; private backspaceWasPressed; private performanceStart; private prevContentLength; /** * Returns whether a typing session is active. */ get getIsTypingSessionActive(): boolean; /** * Sets the previous content length. */ set setPrevContentLength(value: number); /** * Processes the paste event. * @param pastedText - Text that was pasted. */ processPaste(pastedText: string): void; /** * Processes the autocorrection event. * @param textInputValue - New value of the input. */ processAutocorrection(textInputValue: string): void; /** * Processes the prediction event. * @param newValue - New value of the input. * @param textSnapshot - Previous value of the input. */ processPrediction(newValue: string, textSnapshot: string): void; /** * Handles the autocorrection trigger. * @param key - The key that was pressed. * @param text - The current text in the input. */ private handleAutocorrectionTrigger; /** * Processes a keydown event and updates typing data. * @param keyPressed - The key that was pressed. * @param target - The target input element. */ processKeydown(keyPressed: string, target: HTMLInputElement): void; /** * Processes a keyup event and updates typing data. * @param keyPressed - The key that was released. */ processKeyup(keyPressed: string): void; /** * Ends the current typing session and returns the collected typing data. * @returns The collected typing data. */ endTypingSession(): IMobileKeystrokeCollection; /** * Resets the typing data to its initial state. */ resetTypingData(): void; }