alt.showCursor

Shows a cursor on screen based on WebViews / CEF. However, it does not automatically focus a WebView and internally it just increments a number of cursors to show.

It's really dumb and you should use the alternative implementation below for handling a cursor

Declaration

alt.showCursor(state: boolean): void

Usage

alt.showCursor(true);

Real World Example

alt.showCursor(true);

Alternative Implementation

Use this iteration of showCursor to have a single instance of a cursor.

let _cursorCount = 0;

export function showCursor(state: boolean) {
        if (state) {
            _cursorCount += 1;
            try {
                alt.showCursor(true);
            } catch (err) {}
        } else {
            for (let i = 0; i < _cursorCount; i++) {
                try {
                    alt.showCursor(false);
                } catch (err) {}
            }

            _cursorCount = 0;
        }
}

These examples assume you have imported alt from alt-client.

results matching ""

    No results matching ""