Custom Hotkeys
Classes
Section titled “Classes”CustomHotkeys
Section titled “CustomHotkeys”Defined in: packages/isaacscript-common/src/classes/features/other/CustomHotkeys.ts:7
Extends
Section titled “Extends”Feature
Methods
Section titled “Methods”setConditionalHotkey()
Section titled “setConditionalHotkey()”setConditionalHotkey(
getKeyFunc,triggerFunc):void
Defined in: packages/isaacscript-common/src/classes/features/other/CustomHotkeys.ts:79
Helper function to run arbitrary code when you press and release a specific keyboard key.
This can be used to easily set up custom hotkeys to facilitate custom game features or to assist in debugging.
Inputs are checked in the POST_RENDER callback.
This is different from the setHotkey function in that the keyboard activation key is not
hardcoded and is instead the return value of a provided function. This is useful for situations
where the key can change (like if end-users can specify a custom hotkey using Mod Config Menu).
In order to use this function, you must upgrade your mod with ISCFeature.CUSTOM_HOTKEYS.
Parameters
Section titled “Parameters”getKeyFunc
Section titled “getKeyFunc”() => Keyboard | undefined
The function that returns the key that will trigger the hotkey.
triggerFunc
Section titled “triggerFunc”() => void
A function containing the arbitrary code that you want to execute when the hotkey is triggered.
Returns
Section titled “Returns”void
setHotkey()
Section titled “setHotkey()”setHotkey(
keyboard,triggerFunc):void
Defined in: packages/isaacscript-common/src/classes/features/other/CustomHotkeys.ts:108
Helper function to run arbitrary code when you press and release a specific keyboard key.
This can be used to easily set up custom hotkeys to facilitate custom game features or to assist in debugging.
Inputs are checked in the POST_RENDER callback.
In order to use this function, you must upgrade your mod with ISCFeature.CUSTOM_HOTKEYS.
Parameters
Section titled “Parameters”keyboard
Section titled “keyboard”Keyboard
The key that you want to trigger the hotkey.
triggerFunc
Section titled “triggerFunc”() => void
A function containing the arbitrary code that you want to execute when the hotkey is triggered.
Returns
Section titled “Returns”void
unsetConditionalHotkey()
Section titled “unsetConditionalHotkey()”unsetConditionalHotkey(
getKeyFunc):void
Defined in: packages/isaacscript-common/src/classes/features/other/CustomHotkeys.ts:128
Helper function to remove a hotkey created with the setConditionalHotkey function.
In order to use this function, you must upgrade your mod with ISCFeature.CUSTOM_HOTKEYS.
Parameters
Section titled “Parameters”getKeyFunc
Section titled “getKeyFunc”() => Keyboard | undefined
Equal to the getKeyFunc that you passed when initially registering the
hotkey.
Returns
Section titled “Returns”void
unsetHotkey()
Section titled “unsetHotkey()”unsetHotkey(
keyboard):void
Defined in: packages/isaacscript-common/src/classes/features/other/CustomHotkeys.ts:148
Helper function to remove a hotkey created with the setHotkey function.
In order to use this function, you must upgrade your mod with ISCFeature.CUSTOM_HOTKEYS.
Parameters
Section titled “Parameters”keyboard
Section titled “keyboard”Keyboard
Equal to the keyboard value that you passed when initially registering the hotkey.
Returns
Section titled “Returns”void
