record
fun record(holdDurationNanos: Long = 0, callback: (KeyBinder.Bind?) -> Unit, function: () -> Boolean)
Begin recording for a keybind. The resulting keybind, which will be passed to the callback, is not registered automatically.
recording may be cancelled for the following reasons:
the ESC key is pressed
record is called again before the recording is completed, (i.e. starting a new one before the old one is finished)
the instance already has a keybind which matched the one being recorded
the keybind was attempted to be set to just left-click (which is not allowed)
Since
0.24.0
Parameters
hold Duration Nanos
the duration that the keys have to be pressed in the resultant keybind
callback
the function that will be called when recording is completed. the parameter will be null if it failed or was cancelled.
function
the function that will be run when the keybind is pressed
Throws
if the keybind is already present